mirror of
https://github.com/karpathy/nanochat.git
synced 2025-12-06 04:12:13 +00:00
Compare commits
4 Commits
7a762543d5
...
27ad8c76c4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27ad8c76c4 | ||
|
|
4a87a0d19f | ||
|
|
11e68bf442 | ||
|
|
59487556ce |
|
|
@ -244,7 +244,7 @@ class GPT(nn.Module):
|
|||
def forward(self, idx, targets=None, kv_cache=None, loss_reduction='mean'):
|
||||
B, T = idx.size()
|
||||
|
||||
# Grab the rotary embeddings for the current sequence length (they are of shape (1, seq_len, 1, head_dim))
|
||||
# Grab the rotary embeddings for the current sequence length (they are of shape (1, seq_len, 1, head_dim/2))
|
||||
assert T <= self.cos.size(1), f"Sequence length grew beyond the rotary embeddings cache: {T} > {self.cos.size(1)}"
|
||||
assert idx.device == self.cos.device, f"Rotary embeddings and idx are on different devices: {idx.device} != {self.cos.device}"
|
||||
assert self.cos.dtype == torch.bfloat16, "Rotary embeddings must be in bfloat16"
|
||||
|
|
|
|||
18
rustbpe/pyproject.toml
Normal file
18
rustbpe/pyproject.toml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[project]
|
||||
name = "rustbpe"
|
||||
version = "0.1.0"
|
||||
description = "Rust BPE tokenizer from nanochat as standalone package"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
license = {text = "MIT"}
|
||||
dependencies = []
|
||||
|
||||
[build-system]
|
||||
requires = ["maturin>=1.0"]
|
||||
build-backend = "maturin"
|
||||
|
||||
[tool.maturin]
|
||||
module-name = "rustbpe"
|
||||
bindings = "pyo3"
|
||||
python-source = "."
|
||||
features = ["pyo3/extension-module"]
|
||||
Loading…
Reference in New Issue
Block a user