Views
No views yet

huggingface/peft library and trl/sft for one epoch on 1 x A100 (40GB) GPU.trainer = SFTTrainer(
model=model,
train_dataset=train_ds,
eval_dataset=test_ds,
peft_config=peft_config,
dataset_text_field="text",
max_seq_length=2048,
tokenizer=tokenizer,
args=training_arguments,
packing=False
)config = LoraConfig(
lora_alpha=16,
lora_dropout=0.1,
r=64,
bias="none",
task_type="CAUSAL_LM",
target_modules = ['q_proj', 'k_proj', 'down_proj', 'v_proj', 'o_proj', 'gate_proj', 'up_proj']
)| Step | Training Loss | Validation Loss |
|---|---|---|
| 10 | 1.796200 | 1.774305 |
| 20 | 1.769700 | 1.679720 |
| 30 | 1.626800 | 1.667754 |
| 40 | 1.663400 | 1.665188 |
| 50 | 1.565700 | 1.659000 |
| 60 | 1.660300 | 1.658270 |
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
3
4repo_id = "mrm8488/mistral-7b-ft-h4-no_robots_instructions"
5
6model = AutoModelForCausalLM.from_pretrained(repo_id, torch_dtype=torch.bfloat16)
7tokenizer = AutoTokenizer.from_pretrained(repo_id)
8
9gen = pipeline("text-generation", model=model, tokenizer=tokenizer, device=0)
10
11instruction = "[INST] Write an email to say goodbye to me boss [\INST]"
12res = gen(instruction, max_new_tokens=512, temperature=0.3, top_p=0.75, top_k=40, repetition_penalty=1.2, eos_token_id=2)
13print(res[0]['generated_text'])@misc {manuel_romero_2023,
author = { {Manuel Romero} },
title = { mistral-7b-ft-h4-no_robots_instructions (Revision 785446d) },
year = 2023,
url = { https://huggingface.co/mrm8488/mistral-7b-ft-h4-no_robots_instructions },
doi = { 10.57967/hf/1426 },
publisher = { Hugging Face }
}