Downloads · 30 days
11
14% of all-time downloads
Craftic/llm-course-hw1-small
llm-course-hw1-small 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
11
14% of all-time downloads
All-time downloads
79
Public
Parameters
79.6M
636 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors318 MB · 100%
How the weights are stored.
F3279.4M · 100%
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=12, n_kv_head=6)smallThese 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-small")
model = TransformerForCausalLM.from_pretrained("Craftic/llm-course-hw1-small")
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]))