SSブログ

秋バラ [ヨコハマ]

秋バラの季節になりました。

山手イタリア山庭園





イングリッシュローズの庭


山下公園
山下公園のバラ


氷川丸とバラ

赤い靴の女の子と豪華客船



今週のチョットGPT
HuggingFaceからzephyr-7b-alpha というモデルが公開されました。
7B(70億パラメータ)のモデルですが、10倍ほどサイズが大きいChat Llama 70Bと同じくらいの性能があるらしいです。
https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha

8bit量子化すると14GB程度のGPUメモリで動かせます。
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torch

model_id = "HuggingFaceH4/zephyr-7b-alpha"
quantization_config = BitsAndBytesConfig(
    load_in_8bit=True,
    torch_dtype=torch.bfloat16
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    quantization_config=quantization_config,
    trust_remote_code=True,
    device_map="auto"
)

messages = [
    {"role": "user", "content": "日本の国花は何ですか?"},
    {"role": "assistant", "content": "日本の国花は、桜です。"},
    {"role": "user", "content": "何故多くの日本人は、桜が好きなのですか?"}
]

encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")

model_inputs = encodeds.to(device)

generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
decoded = tokenizer.batch_decode(generated_ids)
print(decoded[0])

多くの日本人がチーレアスレースに好きである場合を例にします。これは、広告上で人気を集められるとの理由がありますからです。このような場合、広告の効果を高めるために、主幹に集められる必要性があります。 桜の場合、日本の伝統、風化、文化的な價値が非常に高いため、多くの人々が好きなこともあります。桜は、国家の祭典以外にも、学校、団体などで祭りになります。そのために、桜をもつことがお世話になり、これを愛を受けるものとして信じていることが多いです。そのため、桜がポピュラーな原因にあり、多くの人々が好きな理由を持っています。


日本語は、苦手なのかな?


<|user|> Quel est le plus long fleuve du monde ?
<|assistant|> Le plus long fleuve du monde est le Nil, qui coule sur une distance de 6 650 kilomètres (km) à travers l'Afrique. Il naît dans les hautes terres d'Éthiopie sous le nom de Blue Nile, se joint au White Nile à Khartoum sous le nom de Nil, et se jette dans la mer Rouge après avoir traversé l'Égypte.
フランス語は、できるみたい。

<|user|> What does Zephyr mean ?
<|assistant|> Zephyr is the name of a gentle, soft, and calming breeze in Greek mythology. The word derives from the Greek word ZEPHYROS, which means "west wind." In literature, Zephyr is often personified as a god, goddess, or spirit, who brings peace and tranquility. Outside of mythology, the word zephyr is still used today to refer to a light and refreshing wind, particularly in meteorology.
「ゼファーはギリシャ神話に登場する、穏やかで柔らかく、心を落ち着かせるそよ風の名前である。ギリシャ語で "西風 "を意味するZEPHYROSが語源である。文学では、ゼファーはしばしば平和と静けさをもたらす神、女神、精霊として擬人化される。神話以外では、ゼファーという言葉は今日でも、特に気象学において、軽やかで爽やかな風を指す言葉として使われている。」

「女神、精霊として擬人化される。」と答えていますが、Zephyrosは、花の女神フローラの恋人で男性ですね。ちょっと残念。

ちなみに、日本では西風(にし)は、秋の季語ですが、西洋では、西風(Zephyr) は、早春に吹くそよ風のことらしいです。

IZephyr : 西風

nice!(12)  コメント(0) 

nice! 12

コメント 0

コメントを書く

お名前:
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。