SSブログ

目が合いました [相鉄沿線]

カワセミがとても近くまで来てくれました。


ルリビタキは、ちょっと離れたところから様子を見てる。

まんまるで、かわいい。



タイワンリスは、お食事中でした。







今年はプリンターが壊れてしまったので、年賀はがきは、印刷ではなく、切り絵にしようと思って始めたら、予想以上に時間がかかってしまった。

なかなか同じものが作れないので、一つずつ違うのは手作りの良さということにしました。
nice!(14)  コメント(2) 

こども自然公園の紅葉 [相鉄沿線]

こども自然公園のモミジも色づきました。








中池では、カワセミが魚を飲み込もうとしていました。


お腹いっぱいになったみたいです。



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

富士山真っ白 [相鉄沿線]

久しぶりに家の近所からも富士山が見えました。
いつのまにか真っ白


こども自然公園の桜山からは、男体山や女峰山にも雪が積もっているのが見えました。
P1150273.jpg







振り向いたら、猫が後を付いて来てました。

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

急に寒くなりました [相鉄沿線]

先週までは夏日が続いていたのに、急に冬のような寒さになりました。(暦の上では冬でしたね)




こども自然公園の桜山からは、日光の男体山が見えました。
山頂のあたりは雪が降ったのかな?



P1150258.jpg
nice!(17)  コメント(0) 

冬桜 [相鉄沿線]

冬桜が咲いていました。

今年は、10月になっても暖かい日が続いたせいか、例年なら春にしか咲かないこども自然公園の一本桜にも花が咲いていました。



サツキも花盛り


北国からやってきたキンクロハジロは、日影で涼んでいます。







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

見頃になりました。 [相鉄沿線]

追分市民の森のコスモス畑
見頃になりました。








コスモス畑の近くで栗を買いました。




今週のチョットGPT
画像と文を使って、会話ができる、LLaVAというのを試してみました。
LLaVA: Large Language and Vision Assistant
Visual instruction tuning towards large language and vision models with GPT-4 level capabilities
https://github.com/haotian-liu/LLaVA

このページの最初のコスモス畑の写真を使って、会話してみました。
(llava) tama@chotGPT:~/LLM/LLaVA$ python -m llava.serve.cli \
--model-path liuhaotian/llava-v1.5-7b \
--image-file "images/IMG_0626.jpg" \
--load-4bit
[2023-10-08 15:52:55,297] [INFO] [real_accelerator.py:110:get_accelerator] Setting ds_accelerator to cuda (auto detect)
Loading checkpoint shards: 100%|██████████████████████████████████████████████████████████| 2/2 [00:08<00:00, 4.29s/it]
USER: Today I went to a cosmos field in my neighborhood.
ASSISTANT: It sounds like you had a pleasant experience at the cosmos field in your neighborhood. The field is filled with a variety of flowers, including pink and purple ones, creating a beautiful and vibrant scene. The presence of many flowers in the field suggests that it is a popular spot for visitors to enjoy the natural beauty and tranquility of the area. It's great that you decided to visit the field and appreciate the beauty of the flowers and the surrounding environment.
USER:
exit...



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

今週のコスモス畑 [相鉄沿線]

追分市民の森のコスモス畑
来週ぐらいが見頃かな







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

やっと涼しくなりました。 [相鉄沿線]

やっと涼しくなってきました。







風の流れも変わって、桜山から富士山が見えました。




今週のチョットGPT
先週、GPT-4の性能を上回るらしいXwin-LMというモデルが公開されました。https://huggingface.co/Xwin-LM
Hugging Faceのサイトを見ると、開発したのは、マイクロソフト・リサーチ・アジア(中国)や清華大学の4名の方らしいです。
パラメータ数が、70億(7B)、130億(13B)、700億(70B)の3種類のモデルが公開されていたので、130億のXwin-LM-13B-V0.1 を、BitsAndBytes (https://github.com/TimDettmers/bitsandbytes )を使って4ビットに量子化して動かしてみました。
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torch

model_id = "Xwin-LM/Xwin-LM-13B-V0.1"
quantization_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_compute_dtype=torch.float32,
    bnb_4bit_use_double_quant=True,
    bnb_4bit_quant_type="nf4",
)

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    quantization_config=quantization_config,
    device_map="auto",
)


元のモデルのデータ型は、torch.float32で、ファイルサイズは49GBぐらいありますが、4ビット量子化すると9GB程度のGPUメモリで動かすことができます。

「なぜ多くの日本人は。桜が好きなのですか ?」
 という日本語の問いに対して、
「日本の桜の季節は、毎年春にある。この季節には、桜の花が美しく咲き、日本中が満開になる。日本人は、この桜の季節に、家族や友人と共に桜を見て楽しみ、桜の花を見ることを楽しんでいます。 桜は、日本の国花であり、日本人にとって、桜は国を代表する花であり、日本の美しさを象徴しています。また、桜は春の季節の象徴でもあり、春の来ることを告げる役割も果たしています。」
と、日本語で答えてくれました。
すごい。

AIの言語処理能力のテストで良く使われるBoolQの問題から、
「アテナイ市民は、一生の間五百人評議員を務めることができましたか?」
という問いに対して、
「アテナイの市民は、一生の間に五百人評議員を務めることができました。これは、アテナイの政治制度が非常に幅広い社会参加を促進していたことを示しています。五百人評議員は、市民の代表として政治的な決定を行う機関であり、アテナイの政治的な生活の中心であったため、市民がその中で積極的に働くことが期待されていました。 このような制度は、市民が政治に関与し、社会に貢献できる機会を提供し、アテナイの民主主義的な価値観を強化しました。」
と、それらしい回答をしてくれます。
BoolQでは答えは、true,務めることができた。( https://huggingface.co/datasets/boolq )ということになっていますが、これはテストデータが間違っていて、実際は任期が1年で、生涯で2回までしか務められないので、間違った答えです。

五百人評議会は、中国語では、五百人会議というらしいので、
「アテナイ市民は、一生の間五百人会議の議員を務めることができましたか?」
って、聞いてみたら、

「この問題は、確率と統計学の概念を理解するための基本的な問題です。 解答は、アテナイ市民が一生の間五百人会議の議員を務めることができる確率は、0.5%程度です。 具体的には、以下のような計算で解答を得ます。 1. アテナイ市民の総人口:10,000人 2. 五百人会議の議員数:500人 3. 選抜される確率:1/20(各年の新年祭で選抜される確率)」

って、答えてくれました。賢いのか???

ときどき間違えることは、あるようですがLLMとしては、すごくよくできてると思います。
LLMの分野でも中国の技術進んでますね。
これは、日本ピンチかも...

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

ヒガンバナ [相鉄沿線]

まだまだ暑い日が続いていますが、もう9月も中旬なんですね。
今年は(も)忙しくて、まだ夏休みをとれていません....




コスモスも咲き始めていました。






ひさしぶりに、チョットGPT
6月に「Microsoftがたった13億のパラメーターでGPT-3.5超えのHumanEval50.6%をたたき出す「phi-1」を発表」https://gigazine.net/news/20230622-phi-1-large-language-model-microsoft/
という記事が出ていましたが、先週Hugging faceに microsoft/phi-1_5 が公開されていました。
https://huggingface.co/microsoft/phi-1_5
モデルのファイルサイズが3GBしかないので、10万円以下のゲーミングノートパソコンでも動かせるサイズですね。

Hugging faceのサンプルをちょっと変えて、Pythonで、曜日を取得する方法を聞いてみました。
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

torch.set_default_device('cuda')
model = AutoModelForCausalLM.from_pretrained(
    "microsoft/phi-1_5", trust_remote_code=True, torch_dtype="auto")
tokenizer = AutoTokenizer.from_pretrained(
    "microsoft/phi-1_5", trust_remote_code=True, torch_dtype="auto")


inputs = tokenizer(
    'def get_day_of_the_week(d: datetime) -> str:\n    """ ',
     return_tensors="pt", return_attention_mask=False)

outputs = model.generate(**inputs, max_length=200)
text = tokenizer.batch_decode(outputs)[0]
print(text)


def get_day_of_the_week(d: datetime) -> str:
    """ 
    Given a datetime object, returns the day of the week as a string.
    """
    days_of_week = ["Monday", "Tuesday", "Wednesday", 
        "Thursday", "Friday", "Saturday", "Sunday"]
    return days_of_week[d.weekday()]

<|endoftext|>


ちゃんとできてますね。

これはどうかな?
'Why Do Japanese People Love Sakura so Much ?'

Sakura is a type of flower that blooms in the spring and summer, and is often associated with Japan and its culture. It is a symbol of beauty, grace, and renewal, and is often used in traditional Japanese art and literature. But why do Japanese people love Sakura so much? One reason is that Sakura is a reminder of the beauty and fragility of life. In Japan, life is often seen as a precious gift, and people are encouraged to appreciate the simple things in life. Sakura is a symbol of this appreciation, and is often given as a gift to show love and gratitude. Another reason is that Sakura is a symbol of the changing seasons. In Japan, the seasons are divided into four: spring, summer, autumn, and winter. Each season has its own unique beauty, and Sakura is a symbol of the beauty of spring and summer. It is a reminder that even in the midst of the cold and dark winter months, there is still beauty and hope. But Sakura is not just a symbol of beauty and hope. It is also a symbol of resilience and strength. In Japan, there are many examples of people who have overcome great adversity and hardship. Sakura is a symbol of this resilience, and is often used in traditional Japanese art and literature to represent the strength of the human spirit.

すごい。驚きました。

LLMは、大きなモデルほど性能が良くなると考えられていて、1千億パラメータを超えるモデルもいくつも出てきて、高価なGPUを沢山使って動かすものが増えてきていますが、Microsoft phi-1 は、モデルを大きくするのではなく、AIに学習させるデータの質を良くして、性能を上げているそうです。
学習は、量より質ということなのかな?




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

雨上がり [相鉄沿線]

ちゃんと雨宿りできていたかな






ヤマボウシには、ロリーポップみたいな実が沢山なっていました。

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