YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/model-cards#model-card-metadata)
このモデルを用いた出力例
※Omnicampusの環境では依存環境が壊れてunslothが使えなかったのでColab L4での再現方法
!pip install --no-cache-dir unsloth==2024.12.4 ipywidgets flash-attn==2.7.0.post2
import json
from tqdm import tqdm
from unsloth import FastLanguageModel
model_name = 'myamafuj/gemma-2-27b-it'
max_seq_length = 2048
dtype = None
load_in_4bit = True
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = model_name,
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
trust_remote_code=True,
)
FastLanguageModel.for_inference(model)
datasets = []
with open("/content/elyza-tasks-100-TV_0.jsonl", "r") as f:
item = ""
for line in f:
line = line.strip()
item += line
if item.endswith("}"):
datasets.append(json.loads(item))
item = ""
prompt_template = \
"""###以下は、タスクを説明する指示です。要求を適切に満たす応答を書きなさい。
### 指示:
{}
### 応答:
"""
results = []
for dt in tqdm(datasets):
input = dt["input"]
prompt = prompt_template.format(input)
inputs = tokenizer([prompt], return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, 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})
with open(f"{model_name}_output.jsonl".split('/')[-1], 'w', encoding='utf-8') as f:
for result in results:
json.dump(result, f, ensure_ascii=False)
f.write('\n')
base_model: unsloth/gemma-2-27b-bnb-4bit tags: - text-generation-inference - transformers - unsloth - gemma2 - trl license: apache-2.0 language: - en
Uploaded model
- Developed by: myamafuj
- License: apache-2.0
- Finetuned from model : unsloth/gemma-2-27b-bnb-4bit
This gemma2 model was trained 2x faster with Unsloth and Huggingface's TRL library.
Inference Providers
NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API:
The model has no library tag.