--- base_model: microsoft/Phi-4-mini-instruct library_name: peft pipeline_tag: text-generation tags: - lora - peft - phi-4 --- # davanai 2 A LoRA adapter fine-tuned on **microsoft/Phi-4-mini-instruct** (3.8B), developed by **Vega Aiden Lab**. ## Model details - **Developed by:** Vega Aiden Lab - **Model:** davanai 2 - **Base model:** microsoft/Phi-4-mini-instruct - **Method:** LoRA (PEFT), rank 16 --- ## Run it locally — step by step > This is a LoRA adapter, not a full model. You download the base model **microsoft/Phi-4-mini-instruct** and apply this adapter on top. Phi-4-mini is small (3.8B), so it runs on a normal GPU (8 GB+) or even on CPU if you're patient. ### 1. Install the libraries ```bash pip install torch transformers peft accelerate safetensors ``` ### 2. Log in to Hugging Face ```bash pip install -U "huggingface_hub[cli]" hf auth login ``` Paste a token from https://huggingface.co/settings/tokens when asked. ### 3. Create a file called `run.py` ```python from transformers import AutoModelForCausalLM, AutoTokenizer from peft import PeftModel base = "microsoft/Phi-4-mini-instruct" adapter = "emmaoba/davanai-2" tokenizer = AutoTokenizer.from_pretrained(base) model = AutoModelForCausalLM.from_pretrained( base, device_map="auto", torch_dtype="auto", ) # Apply the davanai 2 adapter model = PeftModel.from_pretrained(model, adapter) model.eval() messages = [{"role": "user", "content": "Hello! Who are you?"}] prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) inputs = tokenizer(prompt, return_tensors="pt").to(model.device) outputs = model.generate(**inputs, max_new_tokens=256, do_sample=True, temperature=0.7) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)) ``` ### 4. Run it ```bash python run.py ``` The first run downloads the base model (once, then cached), then prints davanai 2's reply. --- ## Training configuration - Method: LoRA (PEFT) - Rank (r): 16 - Alpha: 32 - Dropout: 0.05 - Target modules: qkv_proj, o_proj, gate_up_proj, down_proj