Edit model card

日本語でtrainingしたllama2をinstruction用のデータセットでsftしたものになります

base: https://huggingface.co/if001/llama2_ja_small

trainingは以下のscript参照 https://github.com/Lightning-AI/lit-gpt/tree/main

use

from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("if001/sentencepiece_ja", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("if001/llama2_ja_small")

import torch
from transformers import GenerationConfig

instruct="東京でおすすめの観光地を教えてください。。"
prompt=f"""以下は、タスクを説明する指示です。要求を適切に満たす応答を書きなさい。
### 指示:
{instruct}

### 出力:
"""

inputs = tokenizer(prompt, return_tensors="pt")
input_ids = inputs["input_ids"]

generation_config = GenerationConfig(
    temperature=0.8,
    top_p=0.95,
    top_k=50,
    num_beams=1,
    do_sample=True,
    repetition_penalty=1.2,
    pad_token_id= tokenizer.pad_token_id,
    # pad_token_id=tokenizer.unk_token_id,
    eos_token_id=tokenizer.eos_token_id
)
with torch.no_grad():
  generation_output = model.generate(
            input_ids=input_ids,
            generation_config=generation_config,
            return_dict_in_generate=True,
            output_scores=True,
            max_new_tokens=64,
        )
  s = generation_output.sequences[0]
  output = tokenizer.decode(s)
  print(output)

出力

以下は、タスクを説明する指示です。要求を適切に満たす応答を書きなさい。
### 指示:
東京でおすすめの観光地を教えてください。。

### 出力:
- 東京で訪れる料理
- 美術館
- 博物館・新旧東の北京にある船浴場
- モニュッキングスの4つの空き地
- シュノーケリングチャイム、夜の奇抜な街
- ツアーなど、芸術/建築の6つ

dataset

https://huggingface.co/datasets/kunishou/hh-rlhf-49k-ja https://huggingface.co/datasets/kunishou/databricks-dolly-15k-ja

Downloads last month
7
Inference API
Input a message to start chatting with if001/llama2_ja_small_instruct.
Inference API (serverless) has been turned off for this model.

Datasets used to train if001/llama2_ja_small_instruct