SwatGarg commited on
Commit
58295d1
1 Parent(s): 3878cb3

Update generator.py

Browse files
Files changed (1) hide show
  1. generator.py +5 -6
generator.py CHANGED
@@ -7,9 +7,8 @@ st.write(
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,9 +18,11 @@ def load_llm(repo_id="mistralai/Mistral-7B-Instruct-v0.2", token=secret_token):
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:
@@ -33,6 +34,4 @@ def load_llm(repo_id="mistralai/Mistral-7B-Instruct-v0.2", token=secret_token):
33
  # Log or handle other exceptions
34
  return None
35
 
36
- def guardrails():
37
- return None
38
 
 
7
  "Has environment variables been set:",
8
  os.environ["HUGGINGFACE_API_TOKEN"] == st.secrets["HUGGINGFACE_API_TOKEN"])
9
 
 
10
 
11
+ def load_llm(repo_id="mistralai/Mistral-7B-Instruct-v0.2"):
12
  '''
13
  Load the LLM from the HuggingFace model hub
14
  Args:
 
18
  '''
19
 
20
  try:
21
+ secret_token = os.getenv("HUGGINGFACE_API_TOKEN")
22
  llm = HuggingFaceEndpoint(
23
+ repo_id=repo_id,
24
+ model_kwargs={"max_length": 128},
25
+ api_token=secret_token
26
  )
27
  return llm
28
  except ValidationError as e:
 
34
  # Log or handle other exceptions
35
  return None
36
 
 
 
37