mirror of
https://github.com/karpathy/nanochat.git
synced 2025-12-06 04:12:13 +00:00
Compare commits
3 Commits
1e25d10261
...
8ef82c45b5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ef82c45b5 | ||
|
|
bc1fca39f3 | ||
|
|
3b372875c1 |
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,6 +1,7 @@
|
|||
.venv/
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.so
|
||||
rustbpe/target/
|
||||
dev-ignore/
|
||||
report.md
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ class HuggingFaceTokenizer:
|
|||
# -----------------------------------------------------------------------------
|
||||
# Tokenizer based on rustbpe + tiktoken combo
|
||||
import pickle
|
||||
import rustbpe
|
||||
from nanochat import rustbpe
|
||||
import tiktoken
|
||||
|
||||
class RustBPETokenizer:
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ requires = ["maturin>=1.7,<2.0"]
|
|||
build-backend = "maturin"
|
||||
|
||||
[tool.maturin]
|
||||
module-name = "rustbpe"
|
||||
module-name = "nanochat.rustbpe"
|
||||
bindings = "pyo3"
|
||||
python-source = "."
|
||||
manifest-path = "rustbpe/Cargo.toml"
|
||||
|
|
@ -69,6 +69,12 @@ gpu = [
|
|||
]
|
||||
|
||||
[tool.uv]
|
||||
cache-keys = [
|
||||
{ file = "pyproject.toml" },
|
||||
{ file = "rustbpe/src/**/*.rs" },
|
||||
{ file = "rustbpe/Cargo.toml" },
|
||||
{ file = "rustbpe/Cargo.lock" }
|
||||
]
|
||||
conflicts = [
|
||||
[
|
||||
{ extra = "cpu" },
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user