Compare commits

...

4 Commits

Author SHA1 Message Date
guangyusong
cc4445b533
Merge 6ef9f77789 into bc1fca39f3 2025-11-16 17:51:00 -08:00
Andrej Karpathy
bc1fca39f3 mqa -> gqa to reduce confusion 2025-11-15 15:43:37 +00:00
guangyusong
6ef9f77789
Merge pull request #1 from guangyusong/fix/tests-urllib-skip
tests: use urllib and skip on network failure
2025-10-13 20:50:40 -04:00
guangyusong
24b4e79eba tests: replace requests with urllib and skip on network failure in enwik8 fixture 2025-10-13 20:40:38 -04:00
2 changed files with 8 additions and 6 deletions

View File

@ -8,7 +8,7 @@ Notable features:
- norm after token embedding
- no learnable params in rmsnorm
- no bias in linear layers
- Multi-Query Attention (MQA) support for more efficient inference
- Group-Query Attention (GQA) support for more efficient inference
"""
import math
@ -29,7 +29,7 @@ class GPTConfig:
vocab_size: int = 50304
n_layer: int = 12
n_head: int = 6 # number of query heads
n_kv_head: int = 6 # number of key/value heads (MQA)
n_kv_head: int = 6 # number of key/value heads (GQA)
n_embd: int = 768

View File

@ -438,10 +438,12 @@ def enwik8_path():
enwik8_local_path_zip = os.path.join(base_dir, "enwik8.zip")
if not os.path.exists(enwik8_local_path):
print(f"Downloading enwik8 to {enwik8_local_path_zip}")
import requests
response = requests.get(enwik8_url)
with open(enwik8_local_path_zip, "wb") as f:
f.write(response.content)
import urllib.request, urllib.error
try:
with urllib.request.urlopen(enwik8_url, timeout=30) as resp, open(enwik8_local_path_zip, "wb") as f:
f.write(resp.read())
except (urllib.error.URLError, urllib.error.HTTPError) as e:
pytest.skip(f"Network unavailable or download failed: {e}")
with zipfile.ZipFile(enwik8_local_path_zip, "r") as zip_ref:
zip_ref.extractall(base_dir)
print(f"Unzipped enwik8 to {enwik8_local_path}")