###推論方法
model_id = "hara-CU/gemma9b-FT-Candidate241214-1"
dtype = None
load_in_4bit = True
model, tokenizer = FastLanguageModel.from_pretrained( model_name=model_id, dtype=dtype, load_in_4bit=load_in_4bit, trust_remote_code=True, ) FastLanguageModel.for_inference(model)
datasets ="file_path1" #データセットの読み込み
results = []
for dt in tqdm(datasets):
input = dt["input"]
prompt = f"""### 指示\n{input}\n### 回答\n"""
inputs = tokenizer([prompt], return_tensors = "pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens = 700, use_cache = True, do_sample=False, repetition_penalty=1.2) prediction = tokenizer.decode(outputs[0], skip_special_tokens=True).split('\n### 回答')[-1]
results.append({"task_id": dt["task_id"], "input": input, "output": prediction})
json_file="file_path2"
with open(json_file, 'w', encoding='utf-8') as f: for result in results: json.dump(result, f, ensure_ascii=False) f.write('\n')
Uploaded model
##使用データセット
weblab-GENIAC/aya-ja-evol-instruct-calm3-dpo-masked
DeL-TaiseiOzaki/Tengentoppa-sft-reasoning-ja
- Developed by: hara-CU
- License: Gemma Terms of Use
- Finetuned from model : hara-CU/gemma-2-9b-Quant-4bit-base
This gemma2 model was trained 2x faster with Unsloth and Huggingface's TRL library.