Fix loading Phi-3 (#48)
This commit is contained in:
committed by
GitHub
parent
e55a0738aa
commit
aabef6b341
@@ -69,7 +69,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 5,
|
"execution_count": null,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"id": "RSNalRXZyTTk"
|
"id": "RSNalRXZyTTk"
|
||||||
},
|
},
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
" \"microsoft/Phi-3-mini-4k-instruct\",\n",
|
" \"microsoft/Phi-3-mini-4k-instruct\",\n",
|
||||||
" device_map=\"cuda\",\n",
|
" device_map=\"cuda\",\n",
|
||||||
" torch_dtype=\"auto\",\n",
|
" torch_dtype=\"auto\",\n",
|
||||||
" trust_remote_code=True,\n",
|
" trust_remote_code=False,\n",
|
||||||
")\n",
|
")\n",
|
||||||
"tokenizer = AutoTokenizer.from_pretrained(\"microsoft/Phi-3-mini-4k-instruct\")"
|
"tokenizer = AutoTokenizer.from_pretrained(\"microsoft/Phi-3-mini-4k-instruct\")"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": null,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"colab": {
|
"colab": {
|
||||||
"base_uri": "https://localhost:8080/",
|
"base_uri": "https://localhost:8080/",
|
||||||
@@ -278,7 +278,7 @@
|
|||||||
" \"microsoft/Phi-3-mini-4k-instruct\",\n",
|
" \"microsoft/Phi-3-mini-4k-instruct\",\n",
|
||||||
" device_map=\"cuda\",\n",
|
" device_map=\"cuda\",\n",
|
||||||
" torch_dtype=\"auto\",\n",
|
" torch_dtype=\"auto\",\n",
|
||||||
" trust_remote_code=True,\n",
|
" trust_remote_code=False,\n",
|
||||||
")\n",
|
")\n",
|
||||||
"tokenizer = AutoTokenizer.from_pretrained(\"microsoft/Phi-3-mini-4k-instruct\")"
|
"tokenizer = AutoTokenizer.from_pretrained(\"microsoft/Phi-3-mini-4k-instruct\")"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -483,7 +483,7 @@
|
|||||||
" \"microsoft/Phi-3-mini-4k-instruct\",\n",
|
" \"microsoft/Phi-3-mini-4k-instruct\",\n",
|
||||||
" device_map=\"cuda\",\n",
|
" device_map=\"cuda\",\n",
|
||||||
" torch_dtype=\"auto\",\n",
|
" torch_dtype=\"auto\",\n",
|
||||||
" trust_remote_code=True,\n",
|
" trust_remote_code=False,\n",
|
||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Create a pipeline\n",
|
"# Create a pipeline\n",
|
||||||
|
|||||||
@@ -100,7 +100,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"# Extract metadata\n",
|
"# Extract metadata\n",
|
||||||
"abstracts = dataset[\"Abstracts\"]\n",
|
"abstracts = dataset[\"Abstracts\"]\n",
|
||||||
"titles = dataset[\"Titles\"]"
|
"titles = dataset[\"Titles\"] "
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -142,7 +142,7 @@
|
|||||||
" \"microsoft/Phi-3-mini-4k-instruct\",\n",
|
" \"microsoft/Phi-3-mini-4k-instruct\",\n",
|
||||||
" device_map=\"cuda\",\n",
|
" device_map=\"cuda\",\n",
|
||||||
" torch_dtype=\"auto\",\n",
|
" torch_dtype=\"auto\",\n",
|
||||||
" trust_remote_code=True,\n",
|
" trust_remote_code=False,\n",
|
||||||
")\n",
|
")\n",
|
||||||
"tokenizer = AutoTokenizer.from_pretrained(\"microsoft/Phi-3-mini-4k-instruct\")\n",
|
"tokenizer = AutoTokenizer.from_pretrained(\"microsoft/Phi-3-mini-4k-instruct\")\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
|||||||
@@ -859,7 +859,7 @@
|
|||||||
"model.config.pretraining_tp = 1\n",
|
"model.config.pretraining_tp = 1\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Load LLaMA tokenizer\n",
|
"# Load LLaMA tokenizer\n",
|
||||||
"tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)\n",
|
"tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=False)\n",
|
||||||
"tokenizer.pad_token = \"<PAD>\"\n",
|
"tokenizer.pad_token = \"<PAD>\"\n",
|
||||||
"tokenizer.padding_side = \"left\""
|
"tokenizer.padding_side = \"left\""
|
||||||
]
|
]
|
||||||
@@ -1598,7 +1598,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"# Load LLaMA tokenizer\n",
|
"# Load LLaMA tokenizer\n",
|
||||||
"model_name = \"TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T\"\n",
|
"model_name = \"TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T\"\n",
|
||||||
"tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)\n",
|
"tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=False)\n",
|
||||||
"tokenizer.pad_token = \"<PAD>\"\n",
|
"tokenizer.pad_token = \"<PAD>\"\n",
|
||||||
"tokenizer.padding_side = \"left\""
|
"tokenizer.padding_side = \"left\""
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user