Views
No views yet
1import torch
2from peft import PeftModel, PeftConfig
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5peft_model_id = "Jay24-AI/bloom-3b-lora-tagger"
6config = PeftConfig.from_pretrained(peft_model_id)
7model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='auto')
8tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
9
10# Load the Lora model
11model = PeftModel.from_pretrained(model, peft_model_id)
12
13batch = tokenizer("“The only way to do great work is to love what you do.” ->:", return_tensors='pt')
14
15with torch.cuda.amp.autocast():
16 output_tokens = model.generate(**batch, max_new_tokens=50)
17
18print('\n\n', tokenizer.decode(output_tokens[0], skip_special_tokens=True))train[:1000]).quote and its corresponding tags.quote and tags into a single text string:
"<quote>" ->: <tags>AutoTokenizer from bigscience/bloom-3b.datasets.map with batched=True."quote ->: tags" format.DataCollatorForLanguageModeling with mlm=False (causal LM objective).outputs/model.config.use_cache = False during training to suppress warnings.| Hyperparameter | Value |
|---|---|
| Base model | bigscience/bloom-3b |
| Adapter method | LoRA (via PEFT) |
| LoRA r | 16 |
| LoRA alpha | 32 |
| LoRA dropout | 0.05 |
| Bias | none |
| Task type | Causal LM |
| Batch size (per device) | 4 |
| Gradient accumulation steps | 4 |
| Effective batch size | 16 |
| Warmup steps | 100 |
| Max steps | 200 |
| Learning rate | 2e-4 |
| Precision | fp16 (mixed precision) |
| Logging steps | 1 |
| Output directory | outputs/ |
| Gradient checkpointing | Enabled |
| Use cache | False (during training) |
os.environ["CUDA_VISIBLE_DEVICES"]="0").1@misc{jay24ai2025bloomlora,
2 title={LoRA Fine-Tuned BLOOM-3B for Quote Tagging},
3 author={Jay24-AI},
4 year={2025},
5 howpublished={\url{https://huggingface.co/Jay24-AI/bloom-3b-lora-tagger}}
6}
7
8---
9
10## Model Card Contact
11
12For questions or issues, contact the maintainer via Hugging Face discussions: https://huggingface.co/Jay24-AI/bloom-3b-lora-tagger/discussions