tinyllava commited on
Commit
dd6bb04
1 Parent(s): a4b8a92

Update modeling_tinyllava_phi.py

Browse files
Files changed (1) hide show
  1. modeling_tinyllava_phi.py +12 -17
modeling_tinyllava_phi.py CHANGED
@@ -1,6 +1,7 @@
1
- from typing import List, Optional, Tuple, Union
2
- import re
3
 
 
4
  import torch
5
  import torch.utils.checkpoint
6
  from torch import nn
@@ -16,19 +17,10 @@ from .configuration import TinyLlavaConfig, IGNORE_INDEX, IMAGE_TOKEN_INDEX, DEF
16
  from transformers import AutoConfig, AutoModelForCausalLM, PhiForCausalLM
17
 
18
  import time
19
-
20
- # from tinyllava.utils.data_utils import get_value_from_kwargs
21
- CONTROLLER_HEART_BEAT_EXPIRATION = 30
22
- WORKER_HEART_BEAT_INTERVAL = 15
23
-
24
- LOGDIR = "."
25
- #
26
- # For licensing see accompanying LICENSE file.
27
- # Copyright (C) 2024 Apple Inc. All Rights Reserved.
28
- #
29
  from transformers.utils import logging
30
-
31
- logger = logging.get_logger(__name__)
 
32
 
33
  # this import has to be relative, otherwise, when setting trust_remote_code=True
34
  # huggingface transformers won't be able to load the module correctly
@@ -38,6 +30,8 @@ from PIL import Image
38
  from io import BytesIO
39
  import base64
40
 
 
 
41
  # Model Constants
42
  IGNORE_INDEX = -100
43
  IMAGE_TOKEN_INDEX = -200
@@ -46,9 +40,10 @@ DEFAULT_IMAGE_PATCH_TOKEN = "<im_patch>"
46
  DEFAULT_IM_START_TOKEN = "<im_start>"
47
  DEFAULT_IM_END_TOKEN = "<im_end>"
48
  IMAGE_PLACEHOLDER = "<image-placeholder>"
49
- import dataclasses
50
- from enum import auto, Enum
51
- from typing import List, Tuple
 
52
 
53
 
54
  class SeparatorStyle(Enum):
 
1
+ # For licensing see accompanying LICENSE file.
2
+ # Copyright (C) 2024 Apple Inc. All Rights Reserved.
3
 
4
+ import re
5
  import torch
6
  import torch.utils.checkpoint
7
  from torch import nn
 
17
  from transformers import AutoConfig, AutoModelForCausalLM, PhiForCausalLM
18
 
19
  import time
 
 
 
 
 
 
 
 
 
 
20
  from transformers.utils import logging
21
+ import dataclasses
22
+ from enum import auto, Enum
23
+ from typing import List, Tuple
24
 
25
  # this import has to be relative, otherwise, when setting trust_remote_code=True
26
  # huggingface transformers won't be able to load the module correctly
 
30
  from io import BytesIO
31
  import base64
32
 
33
+ logger = logging.get_logger(__name__)
34
+
35
  # Model Constants
36
  IGNORE_INDEX = -100
37
  IMAGE_TOKEN_INDEX = -200
 
40
  DEFAULT_IM_START_TOKEN = "<im_start>"
41
  DEFAULT_IM_END_TOKEN = "<im_end>"
42
  IMAGE_PLACEHOLDER = "<image-placeholder>"
43
+
44
+ CONTROLLER_HEART_BEAT_EXPIRATION = 30
45
+ WORKER_HEART_BEAT_INTERVAL = 15
46
+ LOGDIR = "."
47
 
48
 
49
  class SeparatorStyle(Enum):