Views
No views yet
taucris/haiku_333K dataset.Rhapsody TextLM (84M base)Write a haiku about {topic}.\n{haiku_line_1}\n{haiku_line_2}\n{haiku_line_3}<|endoftext|>taucris/haiku_333K dataset.labels[t] = input_ids[t+1]), with prompt tokens and padding fully masked out (-100) so the model only computes loss on the poem contents and the final <|endoftext|> token.taucris/haiku_333K validation set:1import torch
2from rhapsody.inference import load_model, generate_text
3from rhapsody.data import get_tokenizer
4
5device = "cuda" if torch.cuda.is_available() else "cpu"
6
7# Load model and tokenizer
8model_path = "outputs_poet/poet_model.safetensors"
9model = load_model(model_path, device=device)
10tokenizer = get_tokenizer(symbolic=False)
11
12# Define your custom topic
13topic = "lonely night"
14prompt = f"Write a haiku about {topic}.\n"
15
16# Autoregressive generation
17completion = generate_text(
18 model=model,
19 tokenizer=tokenizer,
20 prompt=prompt,
21 max_new_tokens=40,
22 temperature=0.7,
23 repetition_penalty=1.15,
24 device=device
25)
26
27print(completion.strip())lonely night1stars shine in the dark
2their light a beacon of hope
3night's lonely pleadelhi1the chefs knife slices
2delhi's tender flesh and crust
3flavors on the platenew york1old york's rusted gate
2creaks but never breaks the night
3history's hold tight