Spaces:
Sleeping
Sleeping
optional local folder
Browse files
app.py
CHANGED
|
@@ -4,9 +4,16 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline, TextIter
|
|
| 4 |
import time
|
| 5 |
import random
|
| 6 |
from threading import Thread
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Model configuration - using SmolLM2 for efficient inference
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Global variables for model components
|
| 12 |
tokenizer = None
|
|
|
|
| 4 |
import time
|
| 5 |
import random
|
| 6 |
from threading import Thread
|
| 7 |
+
import sys
|
| 8 |
+
import os
|
| 9 |
|
| 10 |
# Model configuration - using SmolLM2 for efficient inference
|
| 11 |
+
# Check for command line argument for local model path
|
| 12 |
+
if len(sys.argv) > 1 and os.path.exists(sys.argv[1]):
|
| 13 |
+
MODEL_NAME = sys.argv[1]
|
| 14 |
+
print(f"Using local model from: {MODEL_NAME}")
|
| 15 |
+
else:
|
| 16 |
+
MODEL_NAME = "HuggingFaceTB/SmolLM2-135M-Instruct"
|
| 17 |
|
| 18 |
# Global variables for model components
|
| 19 |
tokenizer = None
|