Downloads · 30 days
6
15% of all-time downloads
Abhishek161121/falcon-lora-imdb
falcon-lora-imdb is a text generation model from Abhishek161121. 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 QLoRA fine-tuned version of tiiuae/falcon-rw-1b trained on the IMDB movie review dataset for text generation.
Downloads · 30 days
6
15% of all-time downloads
All-time downloads
39
Public
Repo size
6.3 MB
Likes
0
Public
Click a slice to open those files.
.safetensors6.3 MB · 100%
From the Hugging Face model README
This model is a QLoRA fine-tuned version of tiiuae/falcon-rw-1b trained on the IMDB movie review dataset for text generation.
Only the LoRA adapter weights are stored here — the base model is loaded separately from HuggingFace at runtime.
| Property | Value |
|---|---|
| Base Model | tiiuae/falcon-rw-1b |
| Model Type | Causal Language Model |
| Fine-Tuning Method | QLoRA (4-bit NF4 Quantization + LoRA) |
| Dataset | IMDB (500 training samples) |
| Language | English |
| License | Apache 2.0 |
| Training Hardware | NVIDIA GTX 1660 Ti (6GB VRAM) |
| Parameter | Value |
|---|---|
| LoRA Rank (r) | 8 |
| LoRA Alpha | 16 |
| LoRA Dropout | 0.05 |
| Target Modules | query_key_value |
| Task Type | CAUSAL_LM |
| Parameter | Value |
|---|---|
| Quantization | 4-bit NF4 |
| Compute dtype | float16 |
| Double Quantization | Yes |
| Parameter | Value |
|---|---|
| Epochs | 1 |
| Batch Size | 1 |
| Gradient Accumulation Steps | 8 |
| Effective Batch Size | 8 |
| Max Sequence Length | 128 |
| Precision | FP16 |
pip install transformers peft accelerate bitsandbytes torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel, PeftConfig
import torch
adapter_path = "Abhishek161121/falcon-rw-1b-qlora-imdb"
# Load config
peft_config = PeftConfig.from_pretrained(adapter_path)
# Load base model in 4-bit
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16,
bnb_4bit_use_double_quant=True,
)
base_model = AutoModelForCausalLM.from_pretrained(
peft_config.base_model_name_or_path,
quantization_config=bnb_config,
trust_remote_code=True,
device_map="auto"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, adapter_path)
model.eval()
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained(
peft_config.base_model_name_or_path,
trust_remote_code=True
)
tokenizer.pad_token = tokenizer.eos_token
# Generate text
prompt = "The movie was absolutely wonderful because"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=100,
do_sample=True,
temperature=0.8,
top_k=50,
top_p=0.95,
pad_token_id=tokenizer.eos_token_id
)
result = tokenizer.decode(output_ids[0], skip_special_tokens=True)
print(result)
Prompt: "The movie was absolutely wonderful because"
Output: "The movie was absolutely wonderful because of its
heartfelt performances and gripping storyline that
kept me on the edge of my seat throughout..."
Run this after training to upload your adapter:
from huggingface_hub import login
login(token="YOUR_HF_TOKEN") # Get from https://huggingface.co/settings/tokens
model.push_to_hub("YOUR_HF_USERNAME/falcon-rw-1b-qlora-imdb")
tokenizer.push_to_hub("YOUR_HF_USERNAME/falcon-rw-1b-qlora-imdb")
Fine-tuned by [Your Name] · Your HuggingFace Profile