Downloads · 30 days
5
42% of all-time downloads
rayz8821/apartment-lora
apartment-lora is a text generation model from rayz8821. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
This model is a fine-tuned version of TinyLlama/TinyLlama-1.1B-Chat-v1.0 using LoRA (Low-Rank Adaptation).
Downloads · 30 days
5
42% of all-time downloads
All-time downloads
12
Public
Repo size
5 MB
Likes
0
Public
Click a slice to open those files.
.safetensors4.5 MB · 52%
From the Hugging Face model README
This model is a fine-tuned version of TinyLlama/TinyLlama-1.1B-Chat-v1.0 using LoRA (Low-Rank Adaptation).
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)
The model was fine-tuned on custom QA datasets including: