Views
No views yet
- r: 256
- alpha: 128
- dropout: 0.05
- target modules: all-linear- Epochs: 3
- Batch Size: 3
- Gradient Accumulation Steps: 2
- Learning Rate: 2e-4
- Warmup Ratio: 0.03
- Max Sequence Length: 4096
- Scheduler: Constantpip install transformers torch bitsandbytesfrom transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torch
from peft import PeftModel, PeftConfig
# Configure 4-bit quantization
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16
)
model_name = "Geraldine/FineLlama-3.2-3B-Instruct-ead"
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
quantization_config=bnb_config
).to("cuda")
tokenizer = AutoTokenizer.from_pretrained(model_name)messages = [
{"role": "system", "content": "You are an expert in EAD/XML generation for archival records metadata."},
{"role": "user", "content": "Generate a minimal and compliant <eadheader> template with all required EAD/XML tags"},
]
inputs = tokenizer.apply_chat_template(
messages,
return_dict=True,
tokenize = True,
add_generation_prompt = True, # Must add for generation
return_tensors = "pt",
).to("cuda")
outputs = model.generate(**inputs,
max_new_tokens = 4096,
pad_token_id=tokenizer.eos_token_id,
use_cache = True,)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))@misc{ead-llama,
author = {Géraldine Geoffroy},
title = {EAD-XML LLaMa: Fine-tuned LLaMa Model for Archival Description},
year = {2024},
publisher = {HuggingFace},
journal = {HuggingFace Repository},
howpublished = {\url{https://huggingface.co/Geraldine/FineLlama-3.2-3B-Instruct-ead}}
}