Update my_model/KBVQA.py
Browse files- my_model/KBVQA.py +16 -17
my_model/KBVQA.py
CHANGED
@@ -48,24 +48,23 @@ class KBVQA():
|
|
48 |
"""
|
49 |
|
50 |
def __init__(self):
|
51 |
-
|
52 |
-
self.kbvqa_model_name = config.KBVQA_MODEL_NAME
|
53 |
-
self.quantization = config.QUANTIZATION
|
54 |
-
self.max_context_window = config.MAX_CONTEXT_WINDOW
|
55 |
-
self.add_eos_token = config.ADD_EOS_TOKEN
|
56 |
-
self.trust_remote = config.TRUST_REMOTE
|
57 |
-
self.use_fast = config.USE_FAST
|
58 |
-
self.low_cpu_mem_usage=config.LOW_CPU_MEM_USAGE
|
59 |
-
self.kbvqa_tokenizer = None
|
60 |
-
self.captioner = None
|
61 |
-
self.detector = None
|
62 |
-
self.detection_model = None
|
63 |
-
self.detection_confidence = None
|
64 |
-
self.kbvqa_model = None
|
65 |
-
self.bnb_config = self.create_bnb_config()
|
66 |
-
self.access_token = config.HUGGINGFACE_TOKEN
|
67 |
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
def create_bnb_config(self) -> BitsAndBytesConfig:
|
71 |
"""
|
|
|
48 |
"""
|
49 |
|
50 |
def __init__(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
+
self.model_name: str = config.KBVQA_MODEL_NAME
|
53 |
+
self.quantization: str = config.QUANTIZATION
|
54 |
+
self.max_context_window: int = config.MAX_CONTEXT_WINDOW
|
55 |
+
self.add_eos_token: bool = config.ADD_EOS_TOKEN
|
56 |
+
self.trust_remote: bool = config.TRUST_REMOTE
|
57 |
+
self.use_fast: bool = config.USE_FAST
|
58 |
+
self.low_cpu_mem_usage: bool = config.LOW_CPU_MEM_USAGE
|
59 |
+
self.kbvqa_tokenizer: Optional[AutoTokenizer] = None
|
60 |
+
self.captioner: Optional[ImageCaptioningModel] = None
|
61 |
+
self.detector: Optional[ObjectDetector] = None
|
62 |
+
self.detection_model: Optional[str] = None
|
63 |
+
self.detection_confidence: Optional[float] = None
|
64 |
+
self.kbvqa_model: Optional[AutoModelForCausalLM] = None
|
65 |
+
self.bnb_config: BitsAndBytesConfig = self.create_bnb_config()
|
66 |
+
self.access_token: str = config.HUGGINGFACE_TOKEN
|
67 |
+
|
68 |
|
69 |
def create_bnb_config(self) -> BitsAndBytesConfig:
|
70 |
"""
|