Downloads · 30 days
40
18% of all-time downloads
dnakov/nanochat-d20
nanochat-d20 is a text generation model from dnakov. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
Nanochat is a small language model from Andrej Karpathy, converted to HuggingFace format.
Downloads · 30 days
40
18% of all-time downloads
All-time downloads
219
Public
Parameters
561M
2.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.1 GB · 100%
How the weights are stored.
F32477M · 85%
From the Hugging Face model README
Nanochat is a small language model from Andrej Karpathy, converted to HuggingFace format.
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("<model-path>", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("<model-path>")
prompt = "Once upon a time"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=50)
print(tokenizer.decode(outputs[0]))
To use with Apple's MLX framework:
mlx_lm.convert --hf-path <model-path> --mlx-path nanochat-mlx --trust-remote-code
mlx_lm.generate --model nanochat-mlx --prompt "Once upon a time"
Original model by Andrej Karpathy: https://github.com/karpathy/nanochat