Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ from huggingface_hub import login
|
|
| 10 |
import spaces
|
| 11 |
|
| 12 |
# π Login (Hugging Face token should be set as HF_TOKEN env variable)
|
| 13 |
-
login(token=os.environ.get("
|
| 14 |
|
| 15 |
# β
Check for GPU
|
| 16 |
if not torch.cuda.is_available():
|
|
@@ -19,12 +19,12 @@ print(f"β
Using GPU: {torch.cuda.get_device_name(0)}")
|
|
| 19 |
|
| 20 |
# Model setup
|
| 21 |
model_id = "mistralai/Mistral-7B-Instruct-v0.2"
|
| 22 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id, token=os.environ.get("
|
| 23 |
model = AutoModelForCausalLM.from_pretrained(
|
| 24 |
model_id,
|
| 25 |
device_map="auto",
|
| 26 |
torch_dtype=torch.float16,
|
| 27 |
-
token=os.environ.get("
|
| 28 |
trust_remote_code=True
|
| 29 |
)
|
| 30 |
generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
|
|
|
| 10 |
import spaces
|
| 11 |
|
| 12 |
# π Login (Hugging Face token should be set as HF_TOKEN env variable)
|
| 13 |
+
login(token=os.environ.get("token"))
|
| 14 |
|
| 15 |
# β
Check for GPU
|
| 16 |
if not torch.cuda.is_available():
|
|
|
|
| 19 |
|
| 20 |
# Model setup
|
| 21 |
model_id = "mistralai/Mistral-7B-Instruct-v0.2"
|
| 22 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, token=os.environ.get("token"))
|
| 23 |
model = AutoModelForCausalLM.from_pretrained(
|
| 24 |
model_id,
|
| 25 |
device_map="auto",
|
| 26 |
torch_dtype=torch.float16,
|
| 27 |
+
token=os.environ.get("token"),
|
| 28 |
trust_remote_code=True
|
| 29 |
)
|
| 30 |
generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
|