FLFL / README.md
Calvin-Xu's picture
Update README.md
efce917 verified
metadata
license: mit
datasets:
  - Calvin-Xu/FLFL-Aozora-Speech-Train
language:
  - ja
metrics:
  - sacrebleu
pipeline_tag: text2text-generation

FLFL ใƒ•ใƒชใƒ•ใƒช

Furigana (ruby) generation model.

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

torch_dtype = torch.bfloat16 if torch.cuda.is_available() and hasattr(torch.cuda, "is_bf16_supported") and torch.cuda.is_bf16_supported() else torch.float16
model = AutoModelForCausalLM.from_pretrained("Calvin-Xu/FLFL", device_map="auto", torch_dtype=torch_dtype)
tokenizer = AutoTokenizer.from_pretrained("Calvin-Xu/FLFL")

prompt_template = """[INST] {instruction}\n{input}\n[/INST]\n"""
sentence = "ๅ›ฝๅขƒใฎ้•ทใ„ใƒˆใƒณใƒใƒซใ‚’ๆŠœใ‘ใ‚‹ใจ้›ชๅ›ฝใงใ‚ใฃใŸ"

inputs = tokenizer(prompt_template.format(instruction="ๆฌกใฎๆ–‡ใซๆญฃ็ขบใซๆŒฏใ‚Šไปฎๅใ‚’ไป˜ใ‘ใฆใใ ใ•ใ„", input=sentence), return_tensors="pt").to(model.device)
with torch.no_grad():
    tokens = model.generate(**inputs, max_new_tokens=512, do_sample=False)

output = tokenizer.decode(tokens[0], skip_special_tokens=False)
print(output)
# <ruby>ๅ›ฝๅขƒ<rt>ใใซใ–ใ‹ใ„</rt></ruby>ใฎ<ruby>้•ท<rt>ใชใŒ</rt></ruby>ใ„ใƒˆใƒณใƒใƒซใ‚’<ruby>ๆŠœ<rt>ใฌ</rt></ruby>ใ‘ใ‚‹ใจ<ruby>้›ชๅ›ฝ<rt>ใ‚†ใใใซ</rt></ruby>ใงใ‚ใฃใŸ<|endoftext|>

Finetuned from

stockmark/gpt-neox-japanese-1.4b

Training Dataset

Trained for slightly over one epoch on Calvin-Xu/FLFL-Aozora-Speech-Train

Training Settings

HuggingFace Trainer, PEFT (r=64, alpha=128)

Control tokens added: [INST], [/INST], <ruby>, </ruby>, <rt>, </rt>

Output Examples

[INST] ๆฌกใฎๆ–‡ใซๆญฃ็ขบใซๆŒฏใ‚Šไปฎๅใ‚’ไป˜ใ‘ใฆใใ ใ•ใ„

ๅ›ฝๅขƒใฎ้•ทใ„ใƒˆใƒณใƒใƒซใ‚’ๆŠœใ‘ใ‚‹ใจ้›ชๅ›ฝใงใ‚ใฃใŸ

[/INST]

<ruby>ๅ›ฝๅขƒ<rt>ใใซใ–ใ‹ใ„</rt></ruby>ใฎ<ruby>้•ท<rt>ใชใŒ</rt></ruby>ใ„ใƒˆใƒณใƒใƒซใ‚’<ruby>ๆŠœ<rt>ใฌ</rt></ruby>ใ‘ใ‚‹ใจ<ruby>้›ชๅ›ฝ<rt>ใ‚†ใใใซ</rt></ruby>ใงใ‚ใฃใŸ<|endoftext|>
  • ้ฐคใถใ‚Šใฎ็…งใฆใ‚Š็„ผใ‚„ใใ€ๅ…ซๅฎ่œใฏใฃใฝใ†ใ•ใ„ใ€ใƒใƒณใƒใƒผใ‚ฐใ€‚<|endoftext|>

  • ไธป่œใ—ใ‚…ใ•ใ„้–ข้€ฃใ‹ใ‚“ใ‚Œใ‚“ใฏใ€่ฆ‹ไบ‹ใฟใ”ใจใชใพใงใฎๅ’Œๆด‹ใ‚ใ‚ˆใ†ไธญใกใ‚…ใ†ๆŠ˜่กทใ›ใฃใกใ‚…ใ†ใ€‚<|endoftext|>

  • ๅˆฅในใคใฎ่€…ใ‚‚ใฎใฎ็›ฎใ‚ใ‚’้€šใคใ†ใ˜ใฆๆญดๅฒใ‚Œใใ—ใ‚’ๅžฃ้–“่ฆ‹ใ‹ใ„ใพใฟใ‚‰ใ‚Œใ‚‹ใจใฏใ€ๆƒณๅƒใใ†ใžใ†ใ‚’่ถ…ใ“ใˆใ‚‹ไฝ“้จ“ใŸใ„ใ‘ใ‚“ใซ้•ใกใŒใ„ใชใ„!<|endoftext|>

  • ๆญขใจใ‚ใ‚‹ใชใ‚‰ใ€ใใฎๅคงๆœฌใŠใŠใ‚‚ใจใ‚’ๆ น็ตถใญใ ใ‚„ใ—ใซใ—ใชใ„ใจๅŠนๆžœใ“ใ†ใ‹ใŒใชใ„ใ‚<|endoftext|>

  • ไธไบบๆฐ—ใตใซใ‚“ใ้Š˜ๆŸ„ใ‹ใถใงใ“ใ‚ŒไปฅไธŠใ„ใ˜ใ‚‡ใ†ไพกๅ€คใ‹ใกใŒไธ‹ใ•ใŒใ‚Šใ‚ˆใ†ใชใ„ใ‹ใ‚‰ใ€ใปใจใ‚“ใฉๅบ•ๅ€คใใ“ใญใ <|endoftext|>

  • ๆ™‚้–“ใ˜ใ‹ใ‚“ใฎๆพฑใŠใ‚Šใฎไธญใชใ‹ใซๆฒˆๆฎฟใกใ‚“ใŸใ„ใ—ใฆใ„ใŸใ‚ˆใ†ใ ใ€‚<|endoftext|>