Update generator.py
Browse files- generator.py +4 -3
generator.py
CHANGED
@@ -7,7 +7,9 @@ st.write(
|
|
7 |
"Has environment variables been set:",
|
8 |
os.environ["HUGGINGFACE_API_TOKEN"] == st.secrets["HUGGINGFACE_API_TOKEN"])
|
9 |
|
10 |
-
|
|
|
|
|
11 |
'''
|
12 |
Load the LLM from the HuggingFace model hub
|
13 |
Args:
|
@@ -17,10 +19,9 @@ def load_llm(repo_id="mistralai/Mistral-7B-Instruct-v0.2", token=os.getenv("HUGG
|
|
17 |
'''
|
18 |
|
19 |
try:
|
20 |
-
api_token = os.getenv("HUGGINGFACE_API_TOKEN")
|
21 |
llm = HuggingFaceEndpoint(
|
22 |
repo_id=repo_id,temperature=0.2,
|
23 |
-
model_kwargs={"max_length": 128
|
24 |
)
|
25 |
return llm
|
26 |
except ValidationError as e:
|
|
|
7 |
"Has environment variables been set:",
|
8 |
os.environ["HUGGINGFACE_API_TOKEN"] == st.secrets["HUGGINGFACE_API_TOKEN"])
|
9 |
|
10 |
+
secret_token=os.getenv("HUGGINGFACE_API_TOKEN")
|
11 |
+
|
12 |
+
def load_llm(repo_id="mistralai/Mistral-7B-Instruct-v0.2", token=secret_token):
|
13 |
'''
|
14 |
Load the LLM from the HuggingFace model hub
|
15 |
Args:
|
|
|
19 |
'''
|
20 |
|
21 |
try:
|
|
|
22 |
llm = HuggingFaceEndpoint(
|
23 |
repo_id=repo_id,temperature=0.2,
|
24 |
+
model_kwargs={"max_length": 128}
|
25 |
)
|
26 |
return llm
|
27 |
except ValidationError as e:
|