Spaces:
Runtime error
Runtime error
Update app.py
Browse filesupdate h-paramters
app.py
CHANGED
@@ -24,13 +24,13 @@ def load_model(model_name="BioGPT"):
|
|
24 |
return tokenizer, model
|
25 |
|
26 |
|
27 |
-
def get_beam_output(sentence, selected_model, min_len,max_len, n_beams):
|
28 |
tokenizer, model = load_model(selected_model)
|
29 |
inputs = tokenizer(sentence, return_tensors="pt")
|
30 |
with torch.no_grad():
|
31 |
beam_output = model.generate(**inputs,
|
32 |
-
min_length=
|
33 |
-
max_length=
|
34 |
num_beams=n_beams,
|
35 |
early_stopping=True
|
36 |
)
|
|
|
24 |
return tokenizer, model
|
25 |
|
26 |
|
27 |
+
def get_beam_output(sentence, selected_model, min_len=100,max_len=512, n_beams=1):
|
28 |
tokenizer, model = load_model(selected_model)
|
29 |
inputs = tokenizer(sentence, return_tensors="pt")
|
30 |
with torch.no_grad():
|
31 |
beam_output = model.generate(**inputs,
|
32 |
+
min_length=min_len,
|
33 |
+
max_length=max_len,
|
34 |
num_beams=n_beams,
|
35 |
early_stopping=True
|
36 |
)
|