Views
No views yet
tuongvy2603/BITD_baseline — a second-stage continued SFT on the full_data / k=100 data pool. Loading base + this adapter gives a model that has been SFT'd twice.k used to build the continued-SFT training set from the full data pool.pip install transformers peft torch1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5# 1. Load base model
6base = AutoModelForCausalLM.from_pretrained(
7 "tuongvy2603/BITD_baseline",
8 dtype=torch.bfloat16,
9 device_map="auto",
10)
11
12# 2. Attach LoRA adapter
13model = PeftModel.from_pretrained(base, "tuongvy2603/continue_sft_bitd_lora_full_data_k100")
14
15# 3. Tokenizer (chat template lives here)
16tok = AutoTokenizer.from_pretrained("tuongvy2603/continue_sft_bitd_lora_full_data_k100")
17
18# 4. Generate
19messages = [{"role": "user", "content": "Pick open-minded or close-minded."}]
20inputs = tok.apply_chat_template(
21 messages, add_generation_prompt=True, return_tensors="pt"
22).to(model.device)
23out = model.generate(inputs, max_new_tokens=64, do_sample=False)
24print(tok.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))PeftModel injects the LoRA weights at runtime. Forward results are mathematically identical to a merged model.llama.cpp / GGUF conversion, or serving stacks that don't load adapters):1merged = model.merge_and_unload()
2merged.save_pretrained("continue_sft_bitd_lora_full_data_k100_merged")
3tok.save_pretrained("continue_sft_bitd_lora_full_data_k100_merged")| Base model | tuongvy2603/BITD_baseline |
| Method | LoRA (PEFT) |
| Data pool | full_data, k = 100 samples / prompt |
| LoRA rank / alpha / dropout | 16 / 32 / 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Epochs | 5.0 |
| Batch size | 8 × 2 grad accum = 16 effective |
| Learning rate | 0.0002, cosine schedule, 10% warmup |
| Max sequence length | 256 |
| Precision | bf16 |
| Loss | Completion-only (prompt tokens masked) |
| Framework | TRL SFTTrainer |
run_config.json in this repo.1@software{vonwerra2020trl,
2 title = {{TRL: Transformers Reinforcement Learning}},
3 author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
4 license = {Apache-2.0},
5 url = {https://github.com/huggingface/trl},
6 year = {2020}
7}