Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,14 +21,14 @@ def main():
|
|
| 21 |
local_model_path = Path.home().joinpath('mistral_models', model_id)
|
| 22 |
local_model_path.mkdir(parents=True, exist_ok=True)
|
| 23 |
|
| 24 |
-
snapshot_download(repo_id=model_id,
|
| 25 |
st.success("Model downloaded successfully!")
|
| 26 |
|
| 27 |
# Load the model and tokenizer
|
| 28 |
st.text("Loading model...")
|
| 29 |
tokenizer = AutoTokenizer.from_pretrained(local_model_path, use_auth_token=hf_token)
|
| 30 |
model = AutoModelForCausalLM.from_pretrained(local_model_path, use_auth_token=hf_token)
|
| 31 |
-
generator = pipeline("text-generation", model=model, tokenizer=tokenizer
|
| 32 |
st.success("Model loaded successfully!")
|
| 33 |
|
| 34 |
user_input = st.text_area("Enter your instruction", "Explain Machine Learning to me in a nutshell.")
|
|
|
|
| 21 |
local_model_path = Path.home().joinpath('mistral_models', model_id)
|
| 22 |
local_model_path.mkdir(parents=True, exist_ok=True)
|
| 23 |
|
| 24 |
+
snapshot_download(repo_id=model_id, local_dir=local_model_path, use_auth_token=hf_token)
|
| 25 |
st.success("Model downloaded successfully!")
|
| 26 |
|
| 27 |
# Load the model and tokenizer
|
| 28 |
st.text("Loading model...")
|
| 29 |
tokenizer = AutoTokenizer.from_pretrained(local_model_path, use_auth_token=hf_token)
|
| 30 |
model = AutoModelForCausalLM.from_pretrained(local_model_path, use_auth_token=hf_token)
|
| 31 |
+
generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
| 32 |
st.success("Model loaded successfully!")
|
| 33 |
|
| 34 |
user_input = st.text_area("Enter your instruction", "Explain Machine Learning to me in a nutshell.")
|