liz-nojaloli-ja / README.md
ebisuke's picture
initial commit
699601b
|
raw
history blame
1.62 kB
# ebisuke/liz-nojaloli-ja
## License
[MIT License](https://opensource.org/licenses/MIT)
ใƒ™ใƒผใ‚นใจใ—ใฆ[rinna/japanese-gpt-neox-3.6b](https://huggingface.co/rinna/japanese-gpt-neox-3.6b)ใ‚’ไฝฟ็”จใ—ใฆใ„ใพใ™ใ€‚
## Description
ใฎใ˜ใ‚ƒใƒญใƒช้ขจๅ‘ณใƒใƒฃใƒƒใƒˆใƒขใƒ‡ใƒซใงใ™ใ€‚
[rinna/japanese-gpt-neox-3.6b](https://huggingface.co/rinna/japanese-gpt-neox-3.6b)ใ‚’ใƒ™ใƒผใ‚นใจใ—ใฆใƒ•ใ‚กใ‚คใƒณใƒใƒฅใƒผใƒณใ—ใฆใ„ใพใ™ใ€‚
## Usage
ใƒฆใƒผใ‚ถใƒผใฎๅ…ฅๅŠ›ใ‚’`็›ธๆ‰‹ใฏ่จ€ใ„ใพใ—ใŸใ€‚ใ€Œ๏ผˆๅ†…ๅฎน๏ผ‰ใ€\n`ใงๆ‹ฌใฃใฆใใ ใ•ใ„ใ€‚
ใƒขใƒ‡ใƒซใฏ`็›ธๆ‰‹ใฏ่จ€ใ„ใพใ—ใŸใ€‚ใ€Œ`ไปฅ้™ใฎๆ–‡่„ˆใ‚’็”Ÿๆˆใ—ใพใ™ใ€‚
ใใ‚Œไปฅ้™ใ‚‚็ถšใๅ ดๅˆใŒใ‚ใ‚‹ใฎใงๅฟ…่ฆใซๅฟœใ˜ใฆ`ใ€`ใฎๆ–‡ๅญ—ใพใงใงๆ‰“ใกๅˆ‡ใฃใฆใใ ใ•ใ„ใ€‚
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
import os
tokenizer = AutoTokenizer.from_pretrained("ebisuke/liz-nojaloli-ja", use_fast=False)
model = AutoModelForCausalLM.from_pretrained("ebisuke/liz-nojaloli-ja", load_in_8bit=True, device_map='auto')
text = "็›ธๆ‰‹ใฏ่จ€ใ„ใพใ—ใŸใ€‚ใ€Œ็œ ใ„ใซใ‚ƒใƒปใƒปใƒปใ€ \nใ‚ใชใŸใฏ่จ€ใ„ใพใ—ใŸใ€‚ใ€Œ"
token_ids = tokenizer.encode(text, add_special_tokens=False, return_tensors="pt")
with torch.no_grad():
output_ids = model.generate(
input_ids=token_ids.to(model.device),
max_new_tokens=1000,
do_sample=True,
temperature=0.7,
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)
```