mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2026-04-10 12:33:42 +00:00
committed by
GitHub
parent
7757c3d308
commit
c21bfe4a23
@@ -1035,6 +1035,12 @@
|
||||
"source": [
|
||||
"from gpt_download import download_and_load_gpt2\n",
|
||||
"from previous_chapters import GPTModel, load_weights_into_gpt\n",
|
||||
"# If the `previous_chapters.py` file is not available locally,\n",
|
||||
"# you can import it from the `llms-from-scratch` PyPI package.\n",
|
||||
"# For details, see: https://github.com/rasbt/LLMs-from-scratch/tree/main/pkg\n",
|
||||
"# E.g.,\n",
|
||||
"# from llms_from_scratch.ch04 import GPTModel\n",
|
||||
"# from llms_from_scratch.ch05 import download_and_load_gpt2, load_weights_into_gpt\n",
|
||||
"\n",
|
||||
"model_size = CHOOSE_MODEL.split(\" \")[-1].lstrip(\"(\").rstrip(\")\")\n",
|
||||
"settings, params = download_and_load_gpt2(model_size=model_size, models_dir=\"gpt2\")\n",
|
||||
@@ -1075,6 +1081,13 @@
|
||||
" token_ids_to_text\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# Alternatively:\n",
|
||||
"# from llms_from_scratch.ch05 import (\n",
|
||||
"# generate_text_simple,\n",
|
||||
"# text_to_token_ids,\n",
|
||||
"# token_ids_to_text\n",
|
||||
"# )\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"text_1 = \"Every effort moves you\"\n",
|
||||
"\n",
|
||||
|
||||
Reference in New Issue
Block a user