lonewolf07/adaption_embedded_systems_qa
18
1---2base_model: meta-llama/Llama-3.3-70B-Instruct-Reference3library_name: peft4license: other5tags:6 - lora7 - peft8 - adapter9 - adaption10---11 12# adaption_embedded_systems_qa13 14## Model Training15 16A LORA adapter for `meta-llama/Llama-3.3-70B-Instruct-Reference`. This model was trained with SFT using [Adaption](https://adaptionlabs.ai)'s AutoScientist on the embedded_systems_qa dataset.17 18 1920 21### AutoScientist Config22 23```json24{25 "job_id": "23453b19-525c-43ef-8796-c66cdec61f24",26 "training_experiment_id": "eff2c40e-4808-40b3-baec-c0396c72dc0f",27 "original_model_name": "meta-llama/Llama-3.3-70B-Instruct-Reference",28 "trained_model_name": "adaption_embedded_systems_qa",29 "training_method": "sft",30 "training_type": "lora",31 "data_format": "chat",32 "hyperparams": {33 "lora": "true",34 "lora_r": 64,35 "n_evals": 5,36 "n_epochs": 3,37 "batch_size": "max",38 "lora_alpha": 128,39 "lora_dropout": 0,40 "min_lr_ratio": 0.1,41 "warmup_ratio": 0.05,42 "weight_decay": 0.02,43 "learning_rate": 0.0001,44 "max_grad_norm": 1,45 "base_model_size": "70B",46 "train_on_inputs": "false",47 "training_method": "sft",48 "lr_scheduler_type": "cosine",49 "scheduler_num_cycles": 0.5,50 "lora_trainable_modules": "all-linear"51 }52}53```54 55## Training Data56 57The model was trained on 27,536 rows of adapted data with the following domain distribution: code (53%), science (42%), technology (4%), how-to (0%).58 59## Model Evaluation60 61The model was evaluated on an in-distribution held-out test set as well as a broader domain-specific test set to measure generalization.62 63 6465 66| Domain | Win rate vs. base model |67| --- | --- |68| code | 76% |69 70## How to use71 72```bash73pip install torch transformers peft74```75 76```python77import torch78from transformers import AutoModelForCausalLM, AutoTokenizer79from peft import PeftModel80 81BASE = "meta-llama/Llama-3.3-70B-Instruct-Reference"82ADAPTER = "<this-repo-id>"83 84device = "cuda" if torch.cuda.is_available() else "cpu"85dtype = torch.float32 if device == "cpu" else torch.bfloat1686 87base = AutoModelForCausalLM.from_pretrained(BASE, dtype=dtype).to(device)88model = PeftModel.from_pretrained(base, ADAPTER)89# Optional: merge the LoRA weights into the base for faster inference90model = model.merge_and_unload()91model.eval()92 93tokenizer = AutoTokenizer.from_pretrained(BASE)94messages = [{"role": "user", "content": "Hello!"}]95text = tokenizer.apply_chat_template(96 messages, tokenize=False, add_generation_prompt=True)97inputs = tokenizer(text, return_tensors="pt").to(device)98 99with torch.inference_mode():100 out = model.generate(**inputs, max_new_tokens=512)101print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))102```103 