Instructions to use rayz8821/apartment-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use rayz8821/apartment-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat-v1.0") model = PeftModel.from_pretrained(base_model, "rayz8821/apartment-lora") - Notebooks
- Google Colab
- Kaggle
TinyLlama-1.1B-Chat Fine-tuned with LoRA
This model is a fine-tuned version of TinyLlama/TinyLlama-1.1B-Chat-v1.0 using LoRA (Low-Rank Adaptation).
Model Details
- Base Model: TinyLlama-1.1B-Chat-v1.0
- Fine-tuning Method: LoRA with QLoRA (4-bit quantization)
- LoRA Rank: 8
- LoRA Alpha: 32
- Target Modules: q_proj, v_proj
- Training Epochs: 5
Training Details
- Learning Rate: 2e-4
- Batch Size: 1 (with gradient accumulation of 16)
- Precision: FP16
- Final Training Loss: ~2.66
- Final Validation Loss: ~3.18
Usage
from peft import PeftModel
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Load base model
base_model_name = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
model = AutoModelForCausalLM.from_pretrained(
base_model_name,
torch_dtype=torch.float16,
device_map="auto"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(model, "YOUR_USERNAME/apartment-lora")
tokenizer = AutoTokenizer.from_pretrained("YOUR_USERNAME/apartment-lora")
# Generate text
def generate_response(instruction, input_text=""):
prompt = instruction
if input_text:
prompt += "\n" + input_text
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(
**inputs,
max_length=512,
temperature=0.7,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response[len(prompt):].strip()
# Example usage
response = generate_response("Explain quantum computing in simple terms")
print(response)
Training Data
The model was fine-tuned on custom QA datasets including:
- deepseek_qa.jsonl
- claude_qa.jsonl
- chat_qa.jsonl
Limitations
- This is a LoRA adapter, not a full model
- Requires the base model to function
- Performance depends on the quality of training data
- Downloads last month
- 5
Model tree for rayz8821/apartment-lora
Base model
TinyLlama/TinyLlama-1.1B-Chat-v1.0