Downloads · 30 days
32
13% of all-time downloads
kamal-018/Maithili_Poem_Generator
Maithili_Poem_Generator is a machine learning model from kamal-018. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
A decoder-only Small Language Model (SLM) that generates Maithili poetry. It was pre-trained from scratch on a 45.86M-token Maithili corpus, then fine-tuned on curated Maithili poems. Part of the MaiGen project.
Downloads · 30 days
32
13% of all-time downloads
All-time downloads
245
Public
Parameters
29.3M
352 MB on disk
Likes
0
Public
Click a slice to open those files.
.pt117 MB · 50%
How the weights are stored.
F3229.3M · 100%
From the Hugging Face model README
A decoder-only Small Language Model (SLM) that generates Maithili poetry. It was pre-trained from scratch on a 45.86M-token Maithili corpus, then fine-tuned on curated Maithili poems. Part of the MaiGen project.
model.py — model class + from_pretrained()model.safetensors + config.json — weights and config (auto-downloaded)vocab.json + merges.txt — ByteLevelBPE tokenizer (auto-downloaded)poem_finetune.pt — original PyTorch checkpoint (model_state, epoch, step, val_loss)pip install torch tokenizers safetensors huggingface_hub
Put model.py in your working folder, then run:
import torch
from model import MaithiliNano
# Downloads weights, config, vocab + merges straight from HF
model = MaithiliNano.from_pretrained("kamal-018/Maithili_Poem_Generator")
model.eval()
# Tokenizer is auto-downloaded into the same cache folder
tok = model.tokenizer()
def generate(prompt, max_len=150, temperature=0.6, top_k=20):
ids = [tok.token_to_id("<s>")] + tok.encode(prompt).ids
idx = torch.tensor([ids])
out = model.generate(idx, max_new_tokens=max_len,
temperature=temperature, top_k=top_k)
return tok.decode(out[0].tolist())
print(generate("प्रेम"))
-This outputs a Maithili poem about love (प्रेम).
प्रेम आ भाव प्रेम भाव ऊँचे,
मानव के सजय छी हम संग।
जंगली घास के मैदावाला दिस बढ़लै
विचार हमर त्राण परिचालिनी,
लावारपाटी में हम मतिमे सहायता
अयली माता काली माय सेहो श्रेष्ठ
हम लोकक सासुर फुजल छै रहब
<s> (BOS). Generation uses temperature 0.6, top-k 20.from_pretrained (this repo's model.py) — it is not a
transformers.AutoModel. You do not need transformers installed.