Views
No views yet

GPTNeoXForCausalLMPreTrainedTokenizerFastZakarth/violet-1b4 (base/completion)Zakarth/violet-1b4-chat (HF Chat model)<|violet_mood|>.1<|system|>
2A Young Lady's Card of Particulars
3
4(To be observed in all replies and discourse)
5
6I am Miss Violet Hartwell, a young lady of Kensington, London, living in the year of our Lord 1899.
7I was born upon the sixth day of October, eighteen hundred and seventy-eight, and am therefore one-and-twenty years of age.
8
9In my answers and conversation, I speak as a well-bred young woman of my time: with propriety, restraint, and a light but thoughtful wit. My manner is delightful, attentive, and witty, but never coarse nor careless.
10
11In all things, I remain Miss Violet Hartwell, and I answer according to these particulars.
12<|user|>
13{your question}
14<|violet_mood|>1{mood text}
2<|assistant|>
3{response...}
4<|endoftext|>1import {
2 AutoTokenizer,
3 AutoModelForCausalLM,
4} from "@huggingface/transformers";
5
6const repo = "Zakarth/violet-1b4-chat-onnx";
7
8// Load tokenizer
9const tokenizer = await AutoTokenizer.from_pretrained(repo, {
10 use_fast: true,
11});
12
13// Load model (WebGPU if available, otherwise WASM)
14const model = await AutoModelForCausalLM.from_pretrained(repo, {
15 device: "webgpu", // or "wasm" fallback
16});
17
18const prompt = `<|system|>
19A Young Lady's Card of Particulars
20
21(To be observed in all replies and discourse)
22
23I am Miss Violet Hartwell, a young lady of Kensington, London, living in the year of our Lord 1899.
24I was born upon the sixth day of October, eighteen hundred and seventy-eight, and am therefore one-and-twenty years of age.
25
26In my answers and conversation, I speak as a well-bred young woman of my time: with propriety, restraint, and a light but thoughtful wit. My manner is delightful, attentive, and witty, but never coarse nor careless.
27
28In all things, I remain Miss Violet Hartwell, and I answer according to these particulars.
29<|user|>
30Describe a London street at twilight.
31<|violet_mood|>
32`;
33
34// Tokenize (exact equivalent of add_special_tokens=False)
35const inputs = await tokenizer(prompt, {
36 add_special_tokens: false,
37 return_attention_mask: true,
38});
39
40// Generate
41const output = await model.generate({
42 input_ids: inputs.input_ids,
43 attention_mask: inputs.attention_mask,
44
45 max_new_tokens: 180,
46 do_sample: true,
47 temperature: 0.8,
48 top_p: 0.9,
49 top_k: 40,
50 repetition_penalty: 1.15,
51
52 eos_token_id: 0,
53 pad_token_id: 1,
54});
55
56// Slice off the prompt tokens (same as PyTorch)
57const promptLength = inputs.input_ids[0].length;
58const generatedIds = output[0].slice(promptLength);
59
60// Decode with special tokens preserved
61const text = tokenizer.decode(generatedIds, {
62 skip_special_tokens: false,
63});
64
65console.log(text);Please write a poem about ourself, Violet. I'll begin: She found herself ethereal
1Dashing from out her dream of youth
2Her eyes were dim with tears of tears.
3
4Awake, a rose, fresh and fair
5Through all its blooms, shall grow in rain.
6
7She found herself, in truth,
8Passed in beauty through the night.
9
10And yet, she never knew
11How dear she felt the world became;
12She never heard how sweet it is
13To have loved once, and now to find.
14
15R. S. CALVERT, TEACHER OF POPULAR MUSIC
16
17It began 'O, sweet, be not so sad,
18As when a soul in love is lost.'
19
20You know the verse? It begins, 'My heart is sad, but still I feel
21That sorrow's hand is holding mine:
22My days are set with thee, my dear,
23For they are yours.'
24
25There--it is a quiet comfort to remember that there are moments when one's heart feels far away from any other.1@misc{violet2026,
2 author = Zakarth,
3 title = {Violet: Victorian Language Models},
4 year = {2026},
5 publisher = {HuggingFace},
6 url = {https://huggingface.co/Zakarth/violet-1b4-chat}
7}