Spaces:
Runtime error
Runtime error
Update generator.py
Browse files- generator.py +2 -3
generator.py
CHANGED
@@ -2,8 +2,8 @@ import os
|
|
2 |
from langchain_community.llms import HuggingFaceEndpoint
|
3 |
from pydantic import ValidationError
|
4 |
|
5 |
-
|
6 |
-
def load_llm(repo_id="mistralai/Mistral-7B-Instruct-v0.2"
|
7 |
'''
|
8 |
Load the LLM from the HuggingFace model hub
|
9 |
Args:
|
@@ -17,7 +17,6 @@ def load_llm(repo_id="mistralai/Mistral-7B-Instruct-v0.2", token = secret_token)
|
|
17 |
llm = HuggingFaceEndpoint(
|
18 |
repo_id=repo_id,
|
19 |
model_kwargs={"max_length": 128, "api_token": secret_token},
|
20 |
-
api_token=secret_token
|
21 |
)
|
22 |
return llm
|
23 |
except ValidationError as e:
|
|
|
2 |
from langchain_community.llms import HuggingFaceEndpoint
|
3 |
from pydantic import ValidationError
|
4 |
|
5 |
+
secret_token = os.getenv("HUGGINGFACE_API_TOKEN")
|
6 |
+
def load_llm(repo_id="mistralai/Mistral-7B-Instruct-v0.2"):
|
7 |
'''
|
8 |
Load the LLM from the HuggingFace model hub
|
9 |
Args:
|
|
|
17 |
llm = HuggingFaceEndpoint(
|
18 |
repo_id=repo_id,
|
19 |
model_kwargs={"max_length": 128, "api_token": secret_token},
|
|
|
20 |
)
|
21 |
return llm
|
22 |
except ValidationError as e:
|