mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2025-08-28 18:40:01 +00:00
change defaults to 0 temp
This commit is contained in:
parent
59f5ed8d68
commit
bc5cbbf1bd
@ -1852,7 +1852,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"def generate(model, idx, max_new_tokens, context_size, temperature=1.0, top_k=None, eos_id=None):\n",
|
"def generate(model, idx, max_new_tokens, context_size, temperature=0.0, top_k=None, eos_id=None):\n",
|
||||||
"\n",
|
"\n",
|
||||||
" # For-loop is the same as before: Get logits, and only focus on last time step\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",
|
" for _ in range(max_new_tokens):\n",
|
||||||
@ -2442,7 +2442,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.11.4"
|
"version": "3.10.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
@ -215,7 +215,7 @@ def load_weights_into_gpt(gpt, params):
|
|||||||
gpt.out_head.weight = assign(gpt.out_head.weight, params["wte"])
|
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=0.0, top_k=None, eos_id=None):
|
||||||
|
|
||||||
# For-loop is the same as before: Get logits, and only focus on last time step
|
# For-loop is the same as before: Get logits, and only focus on last time step
|
||||||
for _ in range(max_new_tokens):
|
for _ in range(max_new_tokens):
|
||||||
|
@ -254,7 +254,7 @@ def token_ids_to_text(token_ids, tokenizer):
|
|||||||
return tokenizer.decode(flat.tolist())
|
return tokenizer.decode(flat.tolist())
|
||||||
|
|
||||||
|
|
||||||
def generate(model, idx, max_new_tokens, context_size, temperature=1.0, top_k=None, eos_id=None):
|
def generate(model, idx, max_new_tokens, context_size, temperature=0.0, top_k=None, eos_id=None):
|
||||||
|
|
||||||
# For-loop is the same as before: Get logits, and only focus on last time step
|
# For-loop is the same as before: Get logits, and only focus on last time step
|
||||||
for _ in range(max_new_tokens):
|
for _ in range(max_new_tokens):
|
||||||
|
@ -316,7 +316,7 @@ def load_weights_into_gpt(gpt, params):
|
|||||||
gpt.out_head.weight = assign(gpt.out_head.weight, params["wte"])
|
gpt.out_head.weight = assign(gpt.out_head.weight, params["wte"])
|
||||||
|
|
||||||
|
|
||||||
def generate(model, idx, max_new_tokens, context_size, temperature=1.0, top_k=None, eos_id=None):
|
def generate(model, idx, max_new_tokens, context_size, temperature=0.0, top_k=None, eos_id=None):
|
||||||
# For-loop is the same as before: Get logits, and only focus on last time step
|
# For-loop is the same as before: Get logits, and only focus on last time step
|
||||||
for _ in range(max_new_tokens):
|
for _ in range(max_new_tokens):
|
||||||
idx_cond = idx[:, -context_size:]
|
idx_cond = idx[:, -context_size:]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user