Skip to content

Commit

Permalink
change defaults to 0 temp
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt committed May 19, 2024
1 parent 1463b2a commit a5593f9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ch05/01_main-chapter-code/ch05.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@
"metadata": {},
"outputs": [],
"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",
" # For-loop is the same as before: Get logits, and only focus on last time step\n",
" for _ in range(max_new_tokens):\n",
Expand Down Expand Up @@ -2442,7 +2442,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.10.6"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion ch05/01_main-chapter-code/gpt_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,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=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 _ in range(max_new_tokens):
Expand Down
2 changes: 1 addition & 1 deletion ch05/02_alternative_weight_loading/previous_chapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=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 _ in range(max_new_tokens):
Expand Down
2 changes: 1 addition & 1 deletion ch06/02_bonus_additional-experiments/previous_chapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=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 _ in range(max_new_tokens):
idx_cond = idx[:, -context_size:]
Expand Down

0 comments on commit a5593f9

Please sign in to comment.