Upload folder using huggingface_hub
Browse files
api.py
CHANGED
@@ -41,7 +41,7 @@ def fixed_get_imports(filename: str | os.PathLike) -> list[str]:
|
|
41 |
|
42 |
# Initialize the model and processor
|
43 |
with patch("transformers.dynamic_module_utils.get_imports", fixed_get_imports): #workaround for unnecessary flash_attn requirement
|
44 |
-
|
45 |
processor = AutoProcessor.from_pretrained(args.model_path, trust_remote_code=True)
|
46 |
|
47 |
lock = threading.Lock() # Use a lock to ensure thread safety when accessing the model
|
|
|
41 |
|
42 |
# Initialize the model and processor
|
43 |
with patch("transformers.dynamic_module_utils.get_imports", fixed_get_imports): #workaround for unnecessary flash_attn requirement
|
44 |
+
model = AutoModelForCausalLM.from_pretrained(args.model_path, attn_implementation="sdpa", torch_dtype=torch_dtype,trust_remote_code=True).to(device)
|
45 |
processor = AutoProcessor.from_pretrained(args.model_path, trust_remote_code=True)
|
46 |
|
47 |
lock = threading.Lock() # Use a lock to ensure thread safety when accessing the model
|