Spaces:
Sleeping
Sleeping
BeveledCube
commited on
Commit
•
5525b46
1
Parent(s):
c1b0526
re added num_beams
Browse files- models/blenderbot.py +1 -1
- models/fast.py +1 -1
- models/gpt2.py +1 -1
- models/hermes.py +1 -1
- models/llama2.py +1 -1
- models/llama3.py +1 -1
- models/llamatiny.py +1 -1
- models/mamba.py +1 -1
models/blenderbot.py
CHANGED
@@ -23,6 +23,6 @@ def generate(input_text):
|
|
23 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
24 |
|
25 |
# Generate output using the model
|
26 |
-
output_ids = model.generate(input_ids, no_repeat_ngram_size=2, max_new_tokens=
|
27 |
|
28 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
|
|
23 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
24 |
|
25 |
# Generate output using the model
|
26 |
+
output_ids = model.generate(input_ids, no_repeat_ngram_size=2, max_new_tokens=200, num_beams=2, eos_token_id=tokenizer.eos_token_id)
|
27 |
|
28 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
models/fast.py
CHANGED
@@ -11,6 +11,6 @@ def load():
|
|
11 |
|
12 |
def generate(input_text):
|
13 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
14 |
-
output_ids = model.generate(input_ids, no_repeat_ngram_size=2, max_new_tokens=
|
15 |
|
16 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
|
|
11 |
|
12 |
def generate(input_text):
|
13 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
14 |
+
output_ids = model.generate(input_ids, no_repeat_ngram_size=2, max_new_tokens=200, num_beams=2, eos_token_id=tokenizer.eos_token_id)
|
15 |
|
16 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
models/gpt2.py
CHANGED
@@ -16,6 +16,6 @@ def generate(input_text):
|
|
16 |
attention_mask = tf.ones_like(input_ids)
|
17 |
|
18 |
# Generate output using the model
|
19 |
-
output_ids = model.generate(input_ids, num_beams=
|
20 |
|
21 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
|
|
16 |
attention_mask = tf.ones_like(input_ids)
|
17 |
|
18 |
# Generate output using the model
|
19 |
+
output_ids = model.generate(input_ids, num_beams=3, no_repeat_ngram_size=2, max_new_tokens=100, eos_token_id=tokenizer.eos_token_id)
|
20 |
|
21 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
models/hermes.py
CHANGED
@@ -13,6 +13,6 @@ tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
13 |
|
14 |
def generate(messages):
|
15 |
gen_input = tokenizer.apply_chat_template(messages, return_tensors="pt")
|
16 |
-
output_ids = model.generate(**gen_input, num_beams=
|
17 |
|
18 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
|
|
13 |
|
14 |
def generate(messages):
|
15 |
gen_input = tokenizer.apply_chat_template(messages, return_tensors="pt")
|
16 |
+
output_ids = model.generate(**gen_input, num_beams=3, no_repeat_ngram_size=2, max_new_tokens=100, eos_token_id=tokenizer.eos_token_id)
|
17 |
|
18 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
models/llama2.py
CHANGED
@@ -11,6 +11,6 @@ def load():
|
|
11 |
|
12 |
def generate(input_text):
|
13 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
14 |
-
output_ids = model.generate(input_ids, no_repeat_ngram_size=2, max_new_tokens=
|
15 |
|
16 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
|
|
11 |
|
12 |
def generate(input_text):
|
13 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
14 |
+
output_ids = model.generate(input_ids, no_repeat_ngram_size=2, max_new_tokens=200, num_beams=2, eos_token_id=tokenizer.eos_token_id)
|
15 |
|
16 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
models/llama3.py
CHANGED
@@ -11,6 +11,6 @@ def load():
|
|
11 |
|
12 |
def generate(input_text):
|
13 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
14 |
-
output_ids = model.generate(input_ids, no_repeat_ngram_size=2, max_new_tokens=
|
15 |
|
16 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
|
|
11 |
|
12 |
def generate(input_text):
|
13 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
14 |
+
output_ids = model.generate(input_ids, no_repeat_ngram_size=2, max_new_tokens=200, num_beams=2, eos_token_id=tokenizer.eos_token_id)
|
15 |
|
16 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
models/llamatiny.py
CHANGED
@@ -11,6 +11,6 @@ def load():
|
|
11 |
|
12 |
def generate(input_text):
|
13 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
14 |
-
output_ids = model.generate(input_ids, no_repeat_ngram_size=2, max_new_tokens=
|
15 |
|
16 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
|
|
11 |
|
12 |
def generate(input_text):
|
13 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
14 |
+
output_ids = model.generate(input_ids, no_repeat_ngram_size=2, max_new_tokens=200, num_beams=2, eos_token_id=tokenizer.eos_token_id)
|
15 |
|
16 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
models/mamba.py
CHANGED
@@ -11,6 +11,6 @@ def load():
|
|
11 |
|
12 |
def generate(input_text):
|
13 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
14 |
-
output_ids = model.generate(input_ids, no_repeat_ngram_size=2, max_new_tokens=
|
15 |
|
16 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
|
|
11 |
|
12 |
def generate(input_text):
|
13 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
14 |
+
output_ids = model.generate(input_ids, no_repeat_ngram_size=2, max_new_tokens=200, num_beams=2, eos_token_id=tokenizer.eos_token_id)
|
15 |
|
16 |
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|