원본 peft모델: qwopqwop/ALMA-EEVE-v1
사용 데이터셋: qwopqwop/ALMA-R-ko-en
훈련 환경: A6000
epoch: 2
time: 1시간
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import prepare_model_for_kbit_training, PeftModel, PeftConfig
model_path = 'yanolja/EEVE-Korean-10.8B-v1.0'
lora_path = 'qwopqwop/EEVE-ALMA-R'
bnb_config = BitsAndBytesConfig(load_in_4bit=True,bnb_4bit_quant_type="nf4",bnb_4bit_compute_dtype=torch.float16,)
model = AutoModelForCausalLM.from_pretrained(model_path, quantization_config=bnb_config, trust_remote_code=True)
model.config.use_cache = False
model = PeftModel.from_pretrained(model, lora_path)
model = prepare_model_for_kbit_training(model)
tokenizer = AutoTokenizer.from_pretrained(model_path, padding_side='left')
en_text = 'Hi.'
ko_text = '안녕하세요.'
en_prompt = f"Translate this from English to Korean:\nEnglish: {en_text}\nKorean:"
ko_prompt = f"Translate this from Korean to English:\nKorean: {ko_text}\nEnglish:"
input_ids = tokenizer(en_prompt, return_tensors="pt", padding=True, max_length=256, truncation=True).input_ids.cuda()
with torch.no_grad():
generated_ids = model.generate(input_ids=input_ids, num_beams=5, max_new_tokens=20, do_sample=True, temperature=0.6, top_p=0.9)
outputs = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
print(outputs)
input_ids = tokenizer(ko_prompt, return_tensors="pt", padding=True, max_length=256, truncation=True).input_ids.cuda()
with torch.no_grad():
generated_ids = model.generate(input_ids=input_ids, num_beams=5, max_new_tokens=20, do_sample=True, temperature=0.6, top_p=0.9)
outputs = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
print(outputs)
- Downloads last month
- 1
Inference API (serverless) does not yet support peft models for this pipeline type.
Model tree for qwopqwop/EEVE-ALMA-R
Base model
upstage/SOLAR-10.7B-v1.0
Finetuned
yanolja/EEVE-Korean-10.8B-v1.0
Finetuned
yanolja/EEVE-Korean-Instruct-10.8B-v1.0