use default value for temperature

This commit is contained in:
rasbt 2024-05-19 08:48:10 -05:00
parent faffebae4b
commit 59f5ed8d68
3 changed files with 3 additions and 3 deletions

View File

@ -1852,7 +1852,7 @@
"metadata": {},
"outputs": [],
"source": [
"def generate(model, idx, max_new_tokens, context_size, temperature, top_k=None, eos_id=None):\n",
"def generate(model, idx, max_new_tokens, context_size, temperature=1.0, top_k=None, eos_id=None):\n",
"\n",
" # For-loop is the same as before: Get logits, and only focus on last time step\n",
" for _ in range(max_new_tokens):\n",

View File

@ -254,7 +254,7 @@ def token_ids_to_text(token_ids, tokenizer):
return tokenizer.decode(flat.tolist())
def generate(model, idx, max_new_tokens, context_size, temperature, top_k=None, eos_id=None):
def generate(model, idx, max_new_tokens, context_size, temperature=1.0, top_k=None, eos_id=None):
# For-loop is the same as before: Get logits, and only focus on last time step
for _ in range(max_new_tokens):

View File

@ -316,7 +316,7 @@ def load_weights_into_gpt(gpt, params):
gpt.out_head.weight = assign(gpt.out_head.weight, params["wte"])
def generate(model, idx, max_new_tokens, context_size, temperature, top_k=None, eos_id=None):
def generate(model, idx, max_new_tokens, context_size, temperature=1.0, top_k=None, eos_id=None):
# For-loop is the same as before: Get logits, and only focus on last time step
for _ in range(max_new_tokens):
idx_cond = idx[:, -context_size:]