Edit model card

moneyforward/houou-instruction-7b-v2

Overview

The model was trained by supervised fine-tuning (SFT) using an instruction dataset (4802 data) created through joint research with the Institute of Physical and Chemical Research (RIKEN).

The instruction data is the first dataset created from scratch, written in Japanese.

The data details is here.

As a pre-trained model, we used rinna/youri-7b.


How to use the model

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("moneyforward/houou-instruction-7b-v2")
model = AutoModelForCausalLM.from_pretrained("moneyforward/houou-instruction-7b-v2")

if torch.cuda.is_available():
    model = model.to("cuda")
    

instruction = "日本のおすすめの観光地を3つ教えてください。"
input = ""

if input == "":
    prompt = f"""
    以下は、タスクを説明する指示です。要求を適切に満たす応答を書きなさい。

    ### 指示:
    {instruction}

    ### 応答:
    """
else:
    prompt = f"""
    以下は、タスクを説明する指示と、文脈のある入力の組み合わせです。要求を適切に満たす応答を書きなさい。

    ### 指示:
    {instruction}

    ### 入力:
    {input}

    ### 応答:
    """

token_ids = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")

with torch.no_grad():
    output_ids = model.generate(
        token_ids.to(model.device),
        max_new_tokens=2048,
        do_sample=True,
        temperature=0.5,
        pad_token_id=tokenizer.pad_token_id,
        bos_token_id=tokenizer.bos_token_id,
        eos_token_id=tokenizer.eos_token_id,
    )

output = tokenizer.decode(output_ids.tolist()[0])
output = output.split("### 応答:")[1]
print(output)

"""
日本は四季折々の美しい風景や、数々の伝統文化を持つ国です。観光地も数多くありますが、その中から3つ、おすすめの観光地をご紹介します。

1)京都府:清水寺、金閣寺、伏見稲荷大社

 京都は、日本の歴史上とても重要な役割を果たした場所です。清水寺では、「音羽の滝」の水を飲むと美容効果があるといわれています。金閣寺はその名の通り、金で覆われた三層の建造物です。伏見稲荷大社は稲荷神社の総本山で、奥社へ向かう参道に並ぶ鳥居の数は圧巻です。

2)北海道:知床五湖、美瑛町(ケンとメリーの木、パッチワークの丘など)、旭川市(旭山動物園)

 知床半島は、世界自然遺産に登録されています。知床五湖は、その知床半島の自然を満喫できるハイキングコースです。美瑛町は、丘陵地に色とりどりの花が植えられたパッチワークのような風景が広がっています。旭川市にある旭山動物園は、人気がある動物園で、夜行性動物の見やすさが工夫されています。

3)東京都:浅草(浅草寺、仲見世通り、東京スカイツリー)、上野恩賜公園(上野の森美術館、国立西洋美術館など)、日本橋(三越前の日本国道路元標、R.M.V.日本橋など)

 東京にも観光地はたくさんあります。浅草は、昔ながらの下町の雰囲気が残り、老若男女を問わず楽しめる観光地です。上野には、美術館や博物館が多く、上野恩賜公園(上野の森)内を散策するだけでも十分に楽しめます。日本橋は、国道路元標やR.M.V.日本橋など、歴史を感じられる橋であり、最新の技術を感じられる橋でもあります。

 この他にも日本には魅力的な観光地がたくさんあります。ぜひ訪れてみてください。

"""

Evaluation results of rakuda-benchmark

We evaluated the performance of houou-instruction-v1 through GPT-4 automatic evaluation.

As for the comparison model, we used gpt-3.5-turbo-1106.

houou-instruction-v2
win rate
gpt-3.5-turbo-1106 win rate tie
67.5 30 2.5

License

The llama2 license

We have permission from RIKEN to use RIKEN's instruction data for this initiative.

Downloads last month
246
Safetensors
Model size
6.74B params
Tensor type
FP16
·