Spaces:
Running
on
Zero
Running
on
Zero
Update to account for MobileLLM-Pro repository split
Browse files
app.py
CHANGED
|
@@ -9,7 +9,6 @@ from huggingface_hub import login
|
|
| 9 |
import spaces
|
| 10 |
|
| 11 |
MODEL_ID = "facebook/MobileLLM-Pro"
|
| 12 |
-
SUBFOLDER = "instruct" # use the chat template
|
| 13 |
MAX_NEW_TOKENS = 256
|
| 14 |
TEMPERATURE = 0.7
|
| 15 |
TOP_P = 0.95
|
|
@@ -32,12 +31,11 @@ def _ensure_loaded():
|
|
| 32 |
if _tokenizer is not None and _model is not None:
|
| 33 |
return
|
| 34 |
_tokenizer = AutoTokenizer.from_pretrained(
|
| 35 |
-
MODEL_ID, trust_remote_code=True
|
| 36 |
)
|
| 37 |
_model = AutoModelForCausalLM.from_pretrained(
|
| 38 |
MODEL_ID,
|
| 39 |
trust_remote_code=True,
|
| 40 |
-
subfolder=SUBFOLDER,
|
| 41 |
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
|
| 42 |
low_cpu_mem_usage=True,
|
| 43 |
device_map="auto" if torch.cuda.is_available() else None,
|
|
|
|
| 9 |
import spaces
|
| 10 |
|
| 11 |
MODEL_ID = "facebook/MobileLLM-Pro"
|
|
|
|
| 12 |
MAX_NEW_TOKENS = 256
|
| 13 |
TEMPERATURE = 0.7
|
| 14 |
TOP_P = 0.95
|
|
|
|
| 31 |
if _tokenizer is not None and _model is not None:
|
| 32 |
return
|
| 33 |
_tokenizer = AutoTokenizer.from_pretrained(
|
| 34 |
+
MODEL_ID, trust_remote_code=True
|
| 35 |
)
|
| 36 |
_model = AutoModelForCausalLM.from_pretrained(
|
| 37 |
MODEL_ID,
|
| 38 |
trust_remote_code=True,
|
|
|
|
| 39 |
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
|
| 40 |
low_cpu_mem_usage=True,
|
| 41 |
device_map="auto" if torch.cuda.is_available() else None,
|