Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,21 +16,20 @@ print (this_obj[0].id)
|
|
| 16 |
|
| 17 |
def test_fn():
|
| 18 |
out_box=[]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
for i,ea in enumerate(this_obj):
|
|
|
|
| 20 |
try:
|
| 21 |
time = datetime.datetime.now()
|
| 22 |
-
|
| 23 |
-
try:
|
| 24 |
-
client = InferenceClient(f'{this_obj[i].id}')
|
| 25 |
-
#client = InferenceClient("Trelis/Mistral-7B-Instruct-v0.1-Summarize-16k")
|
| 26 |
-
#client = InferenceClient("TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T")
|
| 27 |
-
except Exception as e:
|
| 28 |
-
print (f'{this_obj[i].id}--Function 1 Error :: {e}')
|
| 29 |
-
tot_time=datetime.datetime.now()-time
|
| 30 |
-
out_box.append({"name":this_obj[i].id, "error":f"Function 1 Error :: {e}", "success":"","time":tot_time})
|
| 31 |
-
yield (out_box)
|
| 32 |
-
'''
|
| 33 |
-
out = generate("what is a cat?",this_obj[i].id,True)
|
| 34 |
print (this_obj[i].id +"--"+out)
|
| 35 |
tot_time=datetime.datetime.now()-time
|
| 36 |
out_box.append({"name":this_obj[i].id, "error":f"Function 1 Error :: {e}", "success":f"{out}","time":tot_time})
|
|
@@ -42,7 +41,7 @@ def test_fn():
|
|
| 42 |
yield (out_box)
|
| 43 |
try:
|
| 44 |
time = datetime.datetime.now()
|
| 45 |
-
|
| 46 |
print (this_obj[i].id +"--"+out1)
|
| 47 |
tot_time=datetime.datetime.now()-time
|
| 48 |
out_box.append({"name":this_obj[i].id, "error":f"Function 1 Error :: {e}", "success":f"{out1}","time":tot_time})
|
|
|
|
| 16 |
|
| 17 |
def test_fn():
|
| 18 |
out_box=[]
|
| 19 |
+
generate_kwargs = dict(
|
| 20 |
+
temperature=temperature,
|
| 21 |
+
max_new_tokens=30,
|
| 22 |
+
top_p=top_p,
|
| 23 |
+
repetition_penalty=repetition_penalty,
|
| 24 |
+
do_sample=True,
|
| 25 |
+
seed=42,
|
| 26 |
+
)
|
| 27 |
+
prompt = "what is a cat?"
|
| 28 |
for i,ea in enumerate(this_obj):
|
| 29 |
+
client = InferenceClient(this_obj[i].id)
|
| 30 |
try:
|
| 31 |
time = datetime.datetime.now()
|
| 32 |
+
out = client.text_generation(prompt, **generate_kwargs, stream=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
print (this_obj[i].id +"--"+out)
|
| 34 |
tot_time=datetime.datetime.now()-time
|
| 35 |
out_box.append({"name":this_obj[i].id, "error":f"Function 1 Error :: {e}", "success":f"{out}","time":tot_time})
|
|
|
|
| 41 |
yield (out_box)
|
| 42 |
try:
|
| 43 |
time = datetime.datetime.now()
|
| 44 |
+
out = client.text_generation(prompt, **generate_kwargs, stream=False)
|
| 45 |
print (this_obj[i].id +"--"+out1)
|
| 46 |
tot_time=datetime.datetime.now()-time
|
| 47 |
out_box.append({"name":this_obj[i].id, "error":f"Function 1 Error :: {e}", "success":f"{out1}","time":tot_time})
|