π Fixing pydantic related issue while loading Qwen2_5 class
Browse files
src/utils/qwen_inference.py
CHANGED
@@ -10,6 +10,11 @@ class Qwen2_5(BaseModel):
|
|
10 |
tokenizer: Optional[AutoTokenizer] = None
|
11 |
processor: Optional[AutoProcessor] = None
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
def __init__(self, model_path: str):
|
14 |
super().__init__()
|
15 |
self.model = AutoModelForVision2Seq.from_pretrained(
|
@@ -18,12 +23,6 @@ class Qwen2_5(BaseModel):
|
|
18 |
self.tokenizer = AutoTokenizer.from_pretrained(model_path)
|
19 |
self.processor = AutoProcessor.from_pretrained(model_path)
|
20 |
|
21 |
-
model_config = {
|
22 |
-
"arbitrary_types_allowed": True,
|
23 |
-
"from_attributes": True
|
24 |
-
}
|
25 |
-
|
26 |
-
|
27 |
def prepare_single_inference(self, image: str, question: str):
|
28 |
image = f"data:image;base64,{image}"
|
29 |
messages = [
|
|
|
10 |
tokenizer: Optional[AutoTokenizer] = None
|
11 |
processor: Optional[AutoProcessor] = None
|
12 |
|
13 |
+
model_config = {
|
14 |
+
"arbitrary_types_allowed": True,
|
15 |
+
"from_attributes": True
|
16 |
+
}
|
17 |
+
|
18 |
def __init__(self, model_path: str):
|
19 |
super().__init__()
|
20 |
self.model = AutoModelForVision2Seq.from_pretrained(
|
|
|
23 |
self.tokenizer = AutoTokenizer.from_pretrained(model_path)
|
24 |
self.processor = AutoProcessor.from_pretrained(model_path)
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
def prepare_single_inference(self, image: str, question: str):
|
27 |
image = f"data:image;base64,{image}"
|
28 |
messages = [
|