Uploaded model
- Developed by: katsumi1701
- License: apache-2.0
- Finetuned from model : llm-jp/llm-jp-3-13b
This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.
Sample Usage
Create conda environment at the linux shell:
wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh
export PATH=/root/miniforge3/bin:$PATH
conda init
conda create --name unsloth_env python=3.10 pytorch-cuda=12.1 pytorch cudatoolkit xformers -c pytorch -c nvidia -c xformers -y
conda activate unsloth_env
pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
pip install --no-deps "trl<0.9.0" peft accelerate bitsandbytes
conda install -c conda-forge ipykernel
python -m ipykernel install --user --name=unsloth_env --display-name "Python (unsloth_env)"
Model Inference:
# For Google Colab
# !pip install unsloth
# !pip uninstall unsloth -y && pip install --upgrade --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
# !pip install -U torch
# !pip install -U peft
from unsloth import FastLanguageModel
from peft import PeftModel
import torch
import json
from tqdm import tqdm
import re
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="llm-jp/llm-jp-3-13b",
dtype=None,
load_in_4bit=True,
trust_remote_code=True,
)
model = PeftModel.from_pretrained(
model,
"katsumi1701/llm-jp-3-13b-ft26-uns-I-T0.005-r64-64-ep3-bat8-2-1e-5_lora",
token="(HuggingFaceToken)"
)
FastLanguageModel.for_inference(model)
datasets = [ ... ] # huggingface datasets with "task_id" and "input" data
results = []
for data in tqdm(datasets):
input = data["input"]
prompt = f"""
δ»₯δΈγ―γγΏγΉγ―γθͺ¬ζγγζη€Ίγ§γγθ¦ζ±γι©εγ«ζΊγγεΏηγζΈγγͺγγγ
### ζη€Ί:
{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)
output = tokenizer.decode(outputs[0], skip_special_tokens=True).split('\n### εΏη:')[-1]
results.append({"task_id": data["task_id"], "input": input, "output": output})
# Output results with jsonl format:
with open("output.jsonl", 'w', encoding='utf-8') as f:
for result in results:
json.dump(result, f, ensure_ascii=False)
f.write('\n')
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support
Model tree for katsumi1701/llm-jp-3-13b-ft26-uns-I-T0.005-r64-64-ep3-bat8-2-1e-5_lora
Base model
llm-jp/llm-jp-3-13b