Downloads · 30 days
11
26% of all-time downloads
islam-hajosman/llama3_instruct_fine_tuned_bahn_1k_model
llama3_instruct_fine_tuned_bahn_1k_model is a question answering model from islam-hajosman. Use it when the input is a question plus a passage. It is set up for transformers. The card lists the license as llama3.
Model Name: islam-hajosman/llama3instructfinetunedbahn1kv1model Architecture: Llama 3 Instruct Quantization: 4-bit NF4 with double quantization Domain-Specific Fine-Tuning Dataset: islam-hajosman/deutschebahnfaq1k
Downloads · 30 days
11
26% of all-time downloads
All-time downloads
43
Public
Parameters
8B
16.1 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors16.1 GB · 100%
From the Hugging Face model README
Model Name: islam-hajosman/llama3_instruct_fine_tuned_bahn_1k_v1_model
Architecture: Llama 3 Instruct
Quantization: 4-bit NF4 with double quantization
Domain-Specific Fine-Tuning Dataset: islam-hajosman/deutsche_bahn_faq_1k
This model has been fine-tuned to provide improved answers for frequently asked questions (FAQ) from the Deutsche Bahn website. This is part of a Master's thesis project aiming to enhance the model's domain-specific capabilities.
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.bfloat16
)
lora_config = LoraConfig(
r=16,
lora_alpha=32,
lora_dropout=0.0,
bias="none",
target_modules=['q_proj', 'k_proj', 'v_proj', 'o_proj', 'gate_proj', 'up_proj', 'down_proj'],
task_type="CAUSAL_LM"
)
model = get_peft_model(model, lora_config)
training_args = TrainingArguments(
output_dir="./llama3_instruct_fine_tuned_bahn_1k_v1_output",
dataloader_drop_last=False,
save_strategy="epoch",
logging_strategy="steps",
num_train_epochs=30,
logging_steps=1,
per_device_train_batch_size=8,
gradient_accumulation_steps=8,
optim="adamw_8bit",
learning_rate=1e-4,
lr_scheduler_type="cosine",
warmup_ratio=0.1,
bf16=true,
weight_decay=0.0,
run_name="llama3_instruct_fine_tuned_bahn_1k_v1_report",
report_to="wandb"
)
max_seq_length was set to 512, covering 99.3% of the data. Only 7 entries exceeded this length, which were truncated accordingly.To use this model, load it from Huggingface using the model name islam-hajosman/llama3_instruct_fine_tuned_bahn_1k_v1_model. This model is optimized for providing domain-specific answers to Deutsche Bahn FAQ.
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("islam-hajosman/llama3_instruct_fine_tuned_bahn_1k_v1_model")
model = AutoModelForCausalLM.from_pretrained("islam-hajosman/llama3_instruct_fine_tuned_bahn_1k_v1_model")
input_text = "Ihre Frage hier"
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)