Views
No views yet
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline, set_seed
3
4model = AutoModelForCausalLM.from_pretrained("sbintuitions/sarashina1-7b", torch_dtype=torch.float16, device_map="auto")
5tokenizer = AutoTokenizer.from_pretrained("sbintuitions/sarashina1-7b")
6# If you want to use slow tokenizer
7# tokenizer = AutoTokenizer.from_pretrained("sbintuitions/sarashina1-7b", use_fast=False, revision="slow-tokenizer")
8generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
9set_seed(123)
10
11text = generator(
12 "おはようございます、今日の天気は",
13 max_length=30,
14 do_sample=True,
15 pad_token_id=tokenizer.pad_token_id,
16 num_return_sequences=3,
17)
18
19for t in text:
20 print(t)
21
22# These examples are generated by sarashina1-7b parameters model
23# {'generated_text': 'おはようございます、今日の天気は晴れ!!最高気温は15度、最低気温は7度です。今日も1日頑張りましょー♪写真は、去年'}
24# {'generated_text': 'おはようございます、今日の天気は曇り:cloud:です。 雨予報なので、洗濯物は家の中へ。 :city_sunrise:の見える時間。 今日は'}
25# {'generated_text': 'おはようございます、今日の天気は、晴れ、気温も10度以上に上がるそうです、お日様が当たっていると15度くらいになると思います、朝の'}| Parameters | Vocab size | Training tokens | Architecture | Position type | Layers | Hidden dim | Attention heads |
|---|---|---|---|---|---|---|---|
| 7B | 51200 | 1.0T | GPTNeoX | RoPE | 32 | 4096 | 32 |
| 13B | 51200 | 1.0T | GPTNeoX | RoPE | 40 | 5120 | 40 |
| 65B | 51200 | 800B | GPTNeoX | RoPE | 80 | 8192 | 64 |