Downloads · 30 days
13
1% of all-time downloads
Craftic/llm-course-hw1-mini
llm-course-hw1-mini is a text generation model from Craftic. Use it when you need the model to write or continue text. It is set up for pytorch.
Educational causal language model trained as part of a Deep Learning homework assignment on a Russian jokes corpus.
Downloads · 30 days
13
1% of all-time downloads
All-time downloads
1.5K
Public
Parameters
10.6M
84.4 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors42.2 MB · 100%
How the weights are stored.
F3210.5M · 99%
From the Hugging Face model README
Educational causal language model trained as part of a Deep Learning homework assignment on a Russian jokes corpus.
This repository contains:
vocabulary.json, merges.json)model.safetensorsconfig.jsonn_head=6, n_kv_head=3)miniThese weights were uploaded from a custom homework implementation, so loading requires the same Python classes that were used during training.
import torch
# Define ByteLevelBPETokenizer and TransformerForCausalLM exactly as in the homework notebook.
# Then load artifacts from the Hub:
tokenizer = ByteLevelBPETokenizer.from_pretrained("Craftic/llm-course-hw1-mini")
model = TransformerForCausalLM.from_pretrained("Craftic/llm-course-hw1-mini")
model.eval()
prompt = "Муж приходит домой и говорит:"
input_ids = torch.tensor([tokenizer.encode(prompt)], dtype=torch.long)
attention_mask = torch.ones_like(input_ids)
with torch.no_grad():
logits = model(input_ids, attention_mask)
next_token_id = logits[0, -1].argmax().item()
print(tokenizer.decode(tokenizer.encode(prompt, add_eos_token=False) + [next_token_id]))