Spaces:
Runtime error
Runtime error
new
Browse files
app.py
CHANGED
|
@@ -28,6 +28,8 @@ def query(payload):
|
|
| 28 |
|
| 29 |
|
| 30 |
def inference(input_sentence, max_length, sample_or_greedy, seed=42):
|
|
|
|
|
|
|
| 31 |
if sample_or_greedy == "Sample":
|
| 32 |
parameters = {
|
| 33 |
"max_new_tokens": max_length,
|
|
@@ -52,6 +54,7 @@ def inference(input_sentence, max_length, sample_or_greedy, seed=42):
|
|
| 52 |
model_name = 'bigscience/bloomz-560m'
|
| 53 |
pipe = pipeline("text-generation", model = model_name, tokenizer = model_name)
|
| 54 |
|
|
|
|
| 55 |
if sample_or_greedy == "Sample":
|
| 56 |
res = pipe(input_sentence,
|
| 57 |
max_new_tokens = max_length,
|
|
@@ -69,8 +72,10 @@ def inference(input_sentence, max_length, sample_or_greedy, seed=42):
|
|
| 69 |
early_stopping = False,
|
| 70 |
eos_token_id = None
|
| 71 |
)
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
#res = pipe(payload['inputs'], **payload['parameters'])
|
| 74 |
#data = query(payload)
|
| 75 |
#if "error" in data:
|
| 76 |
# return (None, None, f"<span style='color:red'>ERROR: {data['error']} </span>")
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
def inference(input_sentence, max_length, sample_or_greedy, seed=42):
|
| 31 |
+
|
| 32 |
+
print("max_length", max_length)
|
| 33 |
if sample_or_greedy == "Sample":
|
| 34 |
parameters = {
|
| 35 |
"max_new_tokens": max_length,
|
|
|
|
| 54 |
model_name = 'bigscience/bloomz-560m'
|
| 55 |
pipe = pipeline("text-generation", model = model_name, tokenizer = model_name)
|
| 56 |
|
| 57 |
+
'''
|
| 58 |
if sample_or_greedy == "Sample":
|
| 59 |
res = pipe(input_sentence,
|
| 60 |
max_new_tokens = max_length,
|
|
|
|
| 72 |
early_stopping = False,
|
| 73 |
eos_token_id = None
|
| 74 |
)
|
| 75 |
+
'''
|
| 76 |
+
|
| 77 |
+
res = pipe(payload['inputs'], **payload['parameters'])
|
| 78 |
|
|
|
|
| 79 |
#data = query(payload)
|
| 80 |
#if "error" in data:
|
| 81 |
# return (None, None, f"<span style='color:red'>ERROR: {data['error']} </span>")
|