Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,10 +18,11 @@ from huggingface_hub import InferenceClient, login
|
|
| 18 |
|
| 19 |
class BasicAgent:
|
| 20 |
def __init__(self):
|
|
|
|
| 21 |
login(token=os.environ["HF_TOKEN"])
|
| 22 |
|
| 23 |
self.client = InferenceClient(
|
| 24 |
-
model="Qwen/Qwen2-7B-Instruct",
|
| 25 |
token=os.environ["HF_TOKEN"],
|
| 26 |
timeout=120
|
| 27 |
)
|
|
@@ -43,12 +44,11 @@ Answer with ONLY the exact value requested.<|im_end|>
|
|
| 43 |
prompt=prompt,
|
| 44 |
temperature=0.01,
|
| 45 |
max_new_tokens=100,
|
| 46 |
-
stop_sequences=["<|im_end|>"]
|
| 47 |
-
repetition_penalty=1.1
|
| 48 |
)
|
| 49 |
return response.split("<|im_start|>assistant")[-1].split("<|im_end|>")[0].strip()
|
| 50 |
except Exception as e:
|
| 51 |
-
print(f"Error
|
| 52 |
return ""
|
| 53 |
|
| 54 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
|
|
| 18 |
|
| 19 |
class BasicAgent:
|
| 20 |
def __init__(self):
|
| 21 |
+
# Required for gated models
|
| 22 |
login(token=os.environ["HF_TOKEN"])
|
| 23 |
|
| 24 |
self.client = InferenceClient(
|
| 25 |
+
model="Qwen/Qwen2-7B-Instruct-GPTQ-Int8",
|
| 26 |
token=os.environ["HF_TOKEN"],
|
| 27 |
timeout=120
|
| 28 |
)
|
|
|
|
| 44 |
prompt=prompt,
|
| 45 |
temperature=0.01,
|
| 46 |
max_new_tokens=100,
|
| 47 |
+
stop_sequences=["<|im_end|>"]
|
|
|
|
| 48 |
)
|
| 49 |
return response.split("<|im_start|>assistant")[-1].split("<|im_end|>")[0].strip()
|
| 50 |
except Exception as e:
|
| 51 |
+
print(f"Error: {str(e)}")
|
| 52 |
return ""
|
| 53 |
|
| 54 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|