Update main.py
Browse files
main.py
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
-
from
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
|
|
|
7 |
|
8 |
-
|
9 |
-
inputs = tokenizer(text, return_tensors="pt")
|
10 |
-
|
11 |
-
outputs = model.generate(**inputs, max_new_tokens=20)
|
12 |
-
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
|
1 |
+
from huggingface_hub import snapshot_download
|
2 |
+
from pathlib import Path
|
3 |
+
import os
|
4 |
|
5 |
+
# Убедитесь, что переменная окружения HF_TOKEN установлена
|
6 |
+
token = os.getenv("HF_TOKEN")
|
7 |
+
if not token:
|
8 |
+
raise ValueError("Hugging Face token not found in environment variables")
|
9 |
|
10 |
+
mistral_models_path = Path.home().joinpath('mistral_models', 'Mamba-Codestral-7B-v0.1')
|
11 |
+
mistral_models_path.mkdir(parents=True, exist_ok=True)
|
12 |
|
13 |
+
snapshot_download(repo_id="mistralai/Mamba-Codestral-7B-v0.1", allow_patterns=["params.json", "consolidated.safetensors", "tokenizer.model.v3"], local_dir=mistral_models_path)
|
|
|
|
|
|
|
|