Edit model card

You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

moneyforward/houou-instruction-7b-v1

Overview

The model was trained by supervised fine-tuning (SFT) using an instruction dataset (2903 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-v1")
model = AutoModelForCausalLM.from_pretrained("moneyforward/houou-instruction-7b-v1")

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.97,
        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つを紹介します。


京都

京都は、日本の古都、文化首都として古くから日本の都が置かれていました。「古都京都の文化財」としてユネスコの世界文化遺産に登録されており、「千年の古都」とも呼ばれています。

寺院や仏閣が多く、日本の歴史的な偉人や物語、自然などを表現する風景が数多く存在します。祇園精進料理、抹茶、和菓子など伝統的な京都料理も有名です。


沖縄

沖縄は、日本の最南端に位置し、独自の文化を持つ県です。白い砂浜が美しいビーチ、サンゴでできた島である慶良間諸島、沖縄美ら海水族館、世界遺産の今帰仁城跡と古宇利島、パワースポットである斎場御嶽など、自然や文化的な観光地が数多くあります。

沖縄そば、ラフテー、じゅうしー、島豆腐など沖縄独自の食文化もあります。


北海道

北海道は、日本の最北端に位置し、海洋と山野作りが豊かな県です。大自然を感じられる北海道らしい観光地が多くあります。

知床半島、阿寒湖、釧路湿原、大雪森のガーデン、トマム、摩周湖、美しい星空などが有名です。

グルメも豊富で、海産物、ウニ、イクラ、カニ、ジンギスカン、ホッケ、シャケ、スープカレー、メロン、じゃがいも、芽キャベツなどがあります。


この3つの観光地は、日本国内で有名な観光地であり、それぞれに違った魅力があります。歴史的な神社や寺院、自然や動植物、美味しい食事など、観光客を飽きさせません。
</s>


"""

Evaluation results of rakuda-benchmark

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

As for the comparison models, we trained SFT models using the Dolly and OASSST datasets, respectively.

For the training process, these datasets were translated into Japanese.

houou-instruction-v1
win rate
dolly win rate tie
82.5 12.5 5
houou-instruction-v1
win rate
oasst win rate tie
77.5 15 7.5

License

The llama2 license

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

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