Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import sys, types, importlib.machinery, importlib
|
2 |
|
3 |
spec = importlib.machinery.ModuleSpec('flash_attn', loader=None)
|
@@ -44,8 +54,6 @@ def _getattr(self, name):
|
|
44 |
return _orig_getattr(self, name)
|
45 |
_PrC.__getattribute__ = _getattr
|
46 |
|
47 |
-
REVISION = "ceaf371f01ef66192264811b390bccad475a4f02"
|
48 |
-
|
49 |
# Florence-2 로드
|
50 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
51 |
florence_model = AutoModelForCausalLM.from_pretrained('microsoft/Florence-2-base', revision = REVISION, trust_remote_code=True, torch_dtype=torch.float16)
|
|
|
1 |
+
from huggingface_hub import snapshot_download
|
2 |
+
|
3 |
+
REVISION = "ceaf371f01ef66192264811b390bccad475a4f02"
|
4 |
+
|
5 |
+
LOCAL_FLORENCE_DIR = snapshot_download(
|
6 |
+
repo_id="microsoft/Florence-2-base",
|
7 |
+
revision=REVISION,
|
8 |
+
local_files_only=False
|
9 |
+
)
|
10 |
+
|
11 |
import sys, types, importlib.machinery, importlib
|
12 |
|
13 |
spec = importlib.machinery.ModuleSpec('flash_attn', loader=None)
|
|
|
54 |
return _orig_getattr(self, name)
|
55 |
_PrC.__getattribute__ = _getattr
|
56 |
|
|
|
|
|
57 |
# Florence-2 로드
|
58 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
59 |
florence_model = AutoModelForCausalLM.from_pretrained('microsoft/Florence-2-base', revision = REVISION, trust_remote_code=True, torch_dtype=torch.float16)
|