Views
No views yet
<GOAL>/<CODE>/<HISTORY>/<ACTION> tag format during pretraining, so it has no learned understanding of it.1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4REPO = "bbidpa/Rainbow-Pony-100m-Flutter-base"
5DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
6
7tokenizer = AutoTokenizer.from_pretrained(REPO)
8tokenizer.bos_id = tokenizer.bos_token_id
9tokenizer.eos_id = tokenizer.eos_token_id
10tokenizer.pad_id = tokenizer.pad_token_id
11tokenizer.unk_id = tokenizer.unk_token_id
12tokenizer.sep_id = tokenizer.convert_tokens_to_ids("<sep>")
13
14model = AutoModelForCausalLM.from_pretrained(REPO, trust_remote_code=True).to(DEVICE).eval()
15
16prompt = '''
17MaterialApp(
18 title: appName,
19 theme: ThemeData(
20 // Define the default brightness and colors.
21 colorScheme: ColorScheme.fromSeed(
22 seedColor: Colors.purple,
23 // ···
24 brightness: Brightness.dark,
25 ),
26
27 // Define the default `TextTheme`. Use this to specify the default
28 // text styling for headlines, titles, bodies of text, and more.
29 textTheme: TextTheme(
30 displayLarge: const TextStyle(
31 fontSize: 18.0,
32 fontWeight: FontWeight.w600,
33 letterSpacing: 0.5,
34 ),
35 displayMedium: const TextStyle(
36 color: Colors.black,
37 fontSize: 18.0,
38 fontWeight: FontWeight.w600,
39 letterSpacing: 0.5,
40 ),
41
42'''
43
44prompt_ids = tokenizer.encode(prompt, add_special_tokens=False)
45idx = torch.tensor([[tokenizer.bos_id] + prompt_ids], dtype=torch.long).to(DEVICE)
46
47generated = model.generate(
48 idx,
49 max_new_tokens=300,
50 eos_id=tokenizer.eos_id,
51 top_k=50,
52)
53
54new_tokens = generated[:, idx.shape[1]:]
55text = tokenizer.decode(new_tokens[0].tolist(), skip_special_tokens=True)
56print(text)MaterialApp/ThemeData snippet above[paste your actual generated continuation here]<GOAL>, <CODE>, etc.) without erroring, since the vocabulary is compatible — but don't expect coherent <ACTION>/<CHANGES> output from that, since this model never learned what those tags mean.| Architecture | 100M-parameter decoder-only transformer, trained from scratch |
| Pretraining | 2B tokens (70% Flutter/Dart code, 30% English text) |
| Fine-tuning | None — this is the pre-fine-tuning checkpoint |
| Tokenizer | Custom 16k-vocab BPE, resized to 16022 post-hoc (22 new rows untrained) to match the fine-tuned models' tag vocabulary |