Views
No views yet
bigscience/bloom-7b1; LoRA adapters are MIT-compatible)Abirate/english_quotes) is relatively small, so the model may overfit and generalize poorly outside similar data.1import torch
2from peft import PeftModel, PeftConfig
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5peft_model_id = "Jay24-AI/bloom-7b1-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))quote and its corresponding tags.quote and tags into a single text string: <quote> ->: <tags>AutoTokenizer from bigscience/bloom-7b1.datasets.map with batched=True."quote ->: tags" format.DataCollatorForLanguageModeling with mlm=False (causal LM objective).r: 8lora_alpha: 16lora_dropout: 0.05bias: "none"task_type: "CAUSAL_LM"per_device_train_batch_size: 2gradient_accumulation_steps: 2warmup_steps: 100max_steps: 50learning_rate: 2e-4fp16: Truelogging_steps: 1output_dir: outputs/bitsandbytes.model.config.use_cache = False during training to suppress warnings.lm_head modified to output FP32 for stability.| Hyperparameter | Value |
|---|---|
| Base model | bigscience/bloom-7b1 |
| Adapter method | LoRA (via PEFT) |
| LoRA r | 8 |
| LoRA alpha | 16 |
| LoRA dropout | 0.05 |
| Bias | none |
| Task type | Causal LM |
| Batch size (per device) | 2 |
| Gradient accumulation steps | 2 |
| Effective batch size | 4 |
| Warmup steps | 100 |
| Max steps | 50 |
| Learning rate | 2e-4 |
| Precision | fp16 (mixed precision) |
| Quantization | 8-bit (bitsandbytes) |
| Logging steps | 1 |
| Output directory | outputs/ |
| Gradient checkpointing | Enabled |
| Use cache | False (during training) |
print_trainable_parameters).os.environ["CUDA_VISIBLE_DEVICES"]="0"; specific GPU model not specified, e.g., A100, T4, V100).nf8 type, torch.float16 compute dtype.Abirate/english_quotes).1@misc{jay24ai2025bloomlora,
2 title={LoRA Fine-Tuned BLOOM-7B1 for Quote Tagging},
3 author={Jay24-AI},
4 year={2025},
5 howpublished={\url{https://huggingface.co/Jay24-AI/bloom-7b1-lora-tagger}}
6}