Downloads · 30 days
7
19% of all-time downloads
Irfanuruchi/phi-2-alpaca-lora
phi-2-alpaca-lora is a machine learning model from Irfanuruchi. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
[](https://github.com/IrfanUruchi/phi-2-alpaca-lora) [](https://huggingface.co/Irfanuruchi/phi-2-alpaca-lora) [](https://huggingface.co/microsoft/phi-2/blob/main/LICENSE)
Downloads · 30 days
7
19% of all-time downloads
All-time downloads
36
Public
Parameters
2.8B
5.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors5.6 GB · 100%
From the Hugging Face model README
This repository contains LoRA‑tuned weights for microsoft/phi‑2 (2.7B).
The adapters were trained on:
Targets: q_proj, k_proj, v_proj, dense layers within the transformer.
Adapters were merged after training to produce a standalone Hugging Face checkpoint.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "Irfanuruchi/phi-2-alpaca-lora"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True,
)
prompt = "### Instruction: List three advantages of modular code.\n### Response:"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.inference_mode():
outputs = model.generate(
**inputs,
max_new_tokens=200,
temperature=0.7,
top_p=0.9,
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))