Spaces:
Sleeping
Sleeping
failed to load got ocr model
Browse files
src/parsers/got_ocr_parser.py
CHANGED
@@ -72,7 +72,7 @@ class GotOcrParser(DocumentParser):
|
|
72 |
try:
|
73 |
# Import dependencies inside the method to avoid global import errors
|
74 |
import torch
|
75 |
-
from transformers import
|
76 |
|
77 |
logger.info("Loading GOT-OCR model and processor...")
|
78 |
|
@@ -89,11 +89,12 @@ class GotOcrParser(DocumentParser):
|
|
89 |
)
|
90 |
|
91 |
# Load model with explicit float16 for T4 compatibility
|
92 |
-
cls._model =
|
93 |
'stepfun-ai/GOT-OCR2_0-hf',
|
94 |
low_cpu_mem_usage=True,
|
95 |
device_map=device_map,
|
96 |
-
torch_dtype=torch.float16 # Force float16 for T4 compatibility
|
|
|
97 |
)
|
98 |
|
99 |
# Explicitly convert model to half precision (float16)
|
|
|
72 |
try:
|
73 |
# Import dependencies inside the method to avoid global import errors
|
74 |
import torch
|
75 |
+
from transformers import AutoModel, AutoProcessor
|
76 |
|
77 |
logger.info("Loading GOT-OCR model and processor...")
|
78 |
|
|
|
89 |
)
|
90 |
|
91 |
# Load model with explicit float16 for T4 compatibility
|
92 |
+
cls._model = AutoModel.from_pretrained(
|
93 |
'stepfun-ai/GOT-OCR2_0-hf',
|
94 |
low_cpu_mem_usage=True,
|
95 |
device_map=device_map,
|
96 |
+
torch_dtype=torch.float16, # Force float16 for T4 compatibility
|
97 |
+
trust_remote_code=True
|
98 |
)
|
99 |
|
100 |
# Explicitly convert model to half precision (float16)
|