Spaces:
Configuration error
Configuration error
DoctorSlimm
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,7 @@ print(zero.device) # <-- 'cpu' 🤔
|
|
11 |
|
12 |
|
13 |
# gpu
|
|
|
14 |
|
15 |
@spaces.GPU
|
16 |
def greet(prompts, separator):
|
@@ -19,12 +20,15 @@ def greet(prompts, separator):
|
|
19 |
from transformers.utils import move_cache
|
20 |
from huggingface_hub import snapshot_download, login
|
21 |
|
22 |
-
|
23 |
-
os.environ['HF_HUB_ENABLE_HF_TRANSFER'] = '1'
|
24 |
-
fp = snapshot_download(LLM_MODEL_ID, token=os.getenv('HF_TOKEN'), revision='main')
|
25 |
-
move_cache()
|
26 |
|
27 |
-
model
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
sampling_params = dict(
|
29 |
temperature = 0.3,
|
30 |
ignore_eos = False,
|
|
|
11 |
|
12 |
|
13 |
# gpu
|
14 |
+
model = None
|
15 |
|
16 |
@spaces.GPU
|
17 |
def greet(prompts, separator):
|
|
|
20 |
from transformers.utils import move_cache
|
21 |
from huggingface_hub import snapshot_download, login
|
22 |
|
23 |
+
global model
|
|
|
|
|
|
|
24 |
|
25 |
+
if model is None:
|
26 |
+
LLM_MODEL_ID = "DoctorSlimm/trim-music-31"
|
27 |
+
os.environ['HF_HUB_ENABLE_HF_TRANSFER'] = '1'
|
28 |
+
fp = snapshot_download(LLM_MODEL_ID, token=os.getenv('HF_TOKEN'), revision='main')
|
29 |
+
move_cache()
|
30 |
+
model = LLM(fp)
|
31 |
+
|
32 |
sampling_params = dict(
|
33 |
temperature = 0.3,
|
34 |
ignore_eos = False,
|