Upload folder using huggingface_hub
Browse files
README.md
CHANGED
@@ -109,6 +109,10 @@ TOP_K = 1
|
|
109 |
This automatically downloads the weight file based on the model choice above:
|
110 |
|
111 |
```python
|
|
|
|
|
|
|
|
|
112 |
url = f"https://huggingface.co/rasbt/llama-3.2-from-scratch/resolve/main/{MODEL_FILE}"
|
113 |
|
114 |
if not os.path.exists(MODEL_FILE):
|
@@ -162,7 +166,7 @@ if not os.path.exists(TOKENIZER_FILE):
|
|
162 |
urllib.request.urlretrieve(url, TOKENIZER_FILE)
|
163 |
print(f"Downloaded to {TOKENIZER_FILE}")
|
164 |
|
165 |
-
tokenizer =
|
166 |
|
167 |
if "instruct" in MODEL_FILE:
|
168 |
tokenizer = ChatFormat(tokenizer)
|
@@ -174,6 +178,8 @@ if "instruct" in MODEL_FILE:
|
|
174 |
Lastly, we can generate text via the following code:
|
175 |
|
176 |
```python
|
|
|
|
|
177 |
from model import (
|
178 |
generate,
|
179 |
text_to_token_ids,
|
|
|
109 |
This automatically downloads the weight file based on the model choice above:
|
110 |
|
111 |
```python
|
112 |
+
import os
|
113 |
+
import urllib.request
|
114 |
+
|
115 |
+
|
116 |
url = f"https://huggingface.co/rasbt/llama-3.2-from-scratch/resolve/main/{MODEL_FILE}"
|
117 |
|
118 |
if not os.path.exists(MODEL_FILE):
|
|
|
166 |
urllib.request.urlretrieve(url, TOKENIZER_FILE)
|
167 |
print(f"Downloaded to {TOKENIZER_FILE}")
|
168 |
|
169 |
+
tokenizer = Llama3Tokenizer("tokenizer.model")
|
170 |
|
171 |
if "instruct" in MODEL_FILE:
|
172 |
tokenizer = ChatFormat(tokenizer)
|
|
|
178 |
Lastly, we can generate text via the following code:
|
179 |
|
180 |
```python
|
181 |
+
import time
|
182 |
+
|
183 |
from model import (
|
184 |
generate,
|
185 |
text_to_token_ids,
|