Use Florence-2-base-ft
Browse files
app.py
CHANGED
@@ -38,13 +38,13 @@ import subprocess
|
|
38 |
device = get_device_type()
|
39 |
if (device == "cuda"):
|
40 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
41 |
-
model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-
|
42 |
-
processor = AutoProcessor.from_pretrained("microsoft/Florence-2-
|
43 |
else:
|
44 |
-
#https://huggingface.co/microsoft/Florence-2-
|
45 |
with patch("transformers.dynamic_module_utils.get_imports", fixed_get_imports):
|
46 |
-
model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-
|
47 |
-
processor = AutoProcessor.from_pretrained("microsoft/Florence-2-
|
48 |
|
49 |
DESCRIPTION = "# [Florence-2 base-ft Demo with CPU inference support](https://huggingface.co/microsoft/Florence-2-base-ft)"
|
50 |
|
|
|
38 |
device = get_device_type()
|
39 |
if (device == "cuda"):
|
40 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
41 |
+
model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-base-ft", trust_remote_code=True)
|
42 |
+
processor = AutoProcessor.from_pretrained("microsoft/Florence-2-base-ft", trust_remote_code=True)
|
43 |
else:
|
44 |
+
#https://huggingface.co/microsoft/Florence-2-base-ft/discussions/4
|
45 |
with patch("transformers.dynamic_module_utils.get_imports", fixed_get_imports):
|
46 |
+
model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-base-ft", trust_remote_code=True)
|
47 |
+
processor = AutoProcessor.from_pretrained("microsoft/Florence-2-base-ft", trust_remote_code=True)
|
48 |
|
49 |
DESCRIPTION = "# [Florence-2 base-ft Demo with CPU inference support](https://huggingface.co/microsoft/Florence-2-base-ft)"
|
50 |
|