matsuo-lab's picture
Update README.md
e9d3e3a
|
raw
history blame
3.44 kB
metadata
license: cc-by-nc-4.0

weblab-10b-instruction-sft

Overview

This repository provides a Japanese-centric multilingual GPT-NeoX model of 10 billion parameters.


Benchmarking

  • Japanese benchmark

    • We used Stability-AI/lm-evaluation-harness library for evaluation.
    • The 4-task average accuracy is based on results of JCommonsenseQA-1.1, JNLI-1.1, MARC-ja-1.1, and JSQuAD-1.1.
    • model loading is performed with float16, and evaluation is performed with template version 0.3 using the few-shot in-context learning.
    • The number of few-shots is 3,3,3,2.
    Model Average JCommonsenseQA JNLI MARC-ja JSQuAD
    weblab-10b-instruction-sft 78.78 74.35 65.65 96.06 79.04
    weblab-10b 66.38 65.86 54.19 84.49 60.98

How to use the model

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("matsuo-lab/weblab-10b-instruction-sft")
model = AutoModelForCausalLM.from_pretrained("matsuo-lab/weblab-10b-instruction-sft")

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

text = "倧規樑言θͺžγƒ’デルに぀いてθͺ¬ζ˜Žγ—てください。"
text = f'δ»₯下は、タスクをθͺ¬ζ˜Žγ™γ‚‹ζŒ‡η€Ίγ§γ™γ€‚θ¦ζ±‚γ‚’ι©εˆ‡γ«ζΊ€γŸγ™εΏœη­”γ‚’ζ›Έγγͺさい。\n\n### ζŒ‡η€Ί:\n{text}\n\n### εΏœη­”:'
token_ids = tokenizer.encode(text, add_special_tokens=False, return_tensors="pt")

with torch.no_grad():
    output_ids = model.generate(
        token_ids.to(model.device),
        max_new_tokens=100,
        do_sample=True,
        temperature=0.5,
        top_p=0.9,
        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])
print(output)

Licenese

cc-by-nc-4.0