Downloads · 30 days
13
12% of all-time downloads
alkibijad/nanogpt-srpske-epske-pesme
nanogpt-srpske-epske-pesme is a text generation model from alkibijad. Use it when you need the model to write or continue text. It is set up for pytorch. The card lists the license as other.
This is a small character-level nanoGPT checkpoint trained on Serbian epic folk poetry (tinysrpskeepskepesme).
Downloads · 30 days
13
12% of all-time downloads
All-time downloads
112
Public
Repo size
173 MB
Likes
0
Public
Click a slice to open those files.
.pt129 MB · 75%
From the Hugging Face model README
This is a small character-level nanoGPT checkpoint trained on Serbian epic folk
poetry (tiny_srpske_epske_pesme).
It is based on karpathy/nanoGPT and was trained on alkibijad/tiny_srpske_epske_pesme.
Мали nanoGPT модел трениран на корпусу српских епских народних песама. Ово је ”играчка” модел а не прави велики језички модел.
Example output data is included in this folder. Sample:
И он шета од 'ванаест година,
Док ево ти свога сокола,
И он сједе потеже сивијети,
А на њиме три товара блага,
Која сједи сокола добра коња,
Сваки соколе чадор одјавио,
Те разљуби прихвати љубу:
Што ј' у њега три товара блага,
Држи синџир-товара блага,
Install dependencies:
pip install -r requirements.txt
Minimal Python usage:
import json
import torch
from model import GPTConfig, GPT
# Load config
with open("config.json") as f:
cfg = json.load(f)
# Build model
conf = GPTConfig(
vocab_size=cfg["vocab_size"],
block_size=cfg["block_size"],
n_layer=cfg["n_layer"],
n_head=cfg["n_head"],
n_embd=cfg["n_embd"],
dropout=cfg["dropout"],
bias=cfg["bias"],
)
model = GPT(conf)
model.load_state_dict(torch.load("pytorch_model.bin", map_location="cpu"))
model.eval()
# Tokenize and generate
from char_tokenizer import encode, decode
prompt = "Марко"
ids = torch.tensor([encode(prompt)], dtype=torch.long)
out = model.generate(ids, max_new_tokens=200, temperature=0.8, top_k=40)
print(decode(out[0].tolist()))
Generate ten sample files on CPU:
python scripts/generate_srpske_epske_pesme_outputs.py --device cpu
The default prompt is a single newline character ("\n"). The script uses it
as a short conditioning prefix, then removes it before writing the generated
text files.
You can provide a custom prompt:
python scripts/generate_srpske_epske_pesme_outputs.py --start "Марко" --device cpu
The local training dataset contains 737,054 Unicode characters of Serbian Cyrillic epic poetry and is published as alkibijad/tiny_srpske_epske_pesme.
The raw training text is not included in this model repository. Only the character vocabulary metadata needed for decoding and sampling is included.
out-tiny-srpske-epske-pesme/ckpt.pt: trained PyTorch checkpointpytorch_model.bin: model state_dict for the simpler loading exampleconfig.json: model architecture config for the simpler loading examplechar_tokenizer.py: small character tokenizer helperdata/tiny_srpske_epske_pesme/meta.pkl: character vocabulary metadataconfig/train_srpske_epske_pesme.py: training configurationscripts/generate_srpske_epske_pesme_outputs.py: generation scriptmodel.py: nanoGPT model definition needed by the generation scriptgenerated/srpske_epske_pesme/: example output samples generated from this checkpointrequirements.txt: minimal runtime dependenciesLICENSE: original nanoGPT MIT license for the included codeThe Hub also includes .gitattributes, which is generated by Hugging Face for
Git/LFS file handling.
This is a tiny character-level model trained on a narrow poetry corpus. It can produce text that resembles the form of the training data, but it does not have general language understanding, factual reliability, or chat behavior.