横浜のイルミネーション [ヨコハマ]
今年も美しいイルミネーションの季節になりました。
グランモール公園
クイーンズスクエア
Kアリーナ
横浜ベイクォーター
グランモール公園
クイーンズスクエア
Kアリーナ
横浜ベイクォーター
山手イタリア庭園の黄葉 [ヨコハマ]
先週の写真の続きです。
山手イタリア庭園の大きなイチョウもすっかり黄葉していました。
ブラフ18番館
外交官の家
山手イタリア庭園の大きなイチョウもすっかり黄葉していました。
ブラフ18番館
外交官の家
横浜の黄葉 [ヨコハマ]
今年もまた黄葉の季節になりました。
山下公園通り ポーリン橋
横浜人形の家
ホテルニューグランド
神奈川県民ホール
あかいくつ あかいくつ号のナンバーは、全て150
セクシー田中さんの通勤路 横浜地方裁判所
日本大通り
山下公園通り ポーリン橋
横浜人形の家
ホテルニューグランド
神奈川県民ホール
あかいくつ あかいくつ号のナンバーは、全て150
セクシー田中さんの通勤路 横浜地方裁判所
日本大通り
秋バラ [ヨコハマ]
秋バラの季節になりました。
山手イタリア山庭園
イングリッシュローズの庭
山下公園
今週のチョットGPT
HuggingFaceからzephyr-7b-alpha というモデルが公開されました。
7B(70億パラメータ)のモデルですが、10倍ほどサイズが大きいChat Llama 70Bと同じくらいの性能があるらしいです。
https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha
8bit量子化すると14GB程度のGPUメモリで動かせます。
多くの日本人がチーレアスレースに好きである場合を例にします。これは、広告上で人気を集められるとの理由がありますからです。このような場合、広告の効果を高めるために、主幹に集められる必要性があります。 桜の場合、日本の伝統、風化、文化的な價値が非常に高いため、多くの人々が好きなこともあります。桜は、国家の祭典以外にも、学校、団体などで祭りになります。そのために、桜をもつことがお世話になり、これを愛を受けるものとして信じていることが多いです。そのため、桜がポピュラーな原因にあり、多くの人々が好きな理由を持っています。
日本語は、苦手なのかな?
<|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) は、早春に吹くそよ風のことらしいです。
山手イタリア山庭園
イングリッシュローズの庭
山下公園
今週のチョット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) は、早春に吹くそよ風のことらしいです。
横浜のバラ [ヨコハマ]
イングリッシュローズの庭
ベーリック・ホール
山手234番館
ホテルニューグランド
山下公園
最近話題のChatGPTなどのLLM (Large Language Models)の分野では、モデルの他に、LLMを利用してドキュメントの検索を行ったりチャットボットを作るための仕組みを提供するLangChainやLlamaIndexなどが公開されています。
LangChainが、普通のパソコン (大容量メモリやGPUが不要)でも動かせるGPT4ALLやLlama-cppをサポートした(参照: https://python.langchain.com/en/latest/modules/models/llms/integrations.html )ので、メモリ16GBのノートパソコンで、LLukas22/alpaca-native-7B-4bit-ggjt ( https://huggingface.co/LLukas22/alpaca-native-7B-4bit-ggjt )という4.2GBのサイズのモデルと組み合わせて動かしてみました。
"1. First, we need to know what 'NSGA' stands for. It stands for Non-Standard Generalized Array. \n2. Next, we need to know what a 'Kami seya' is. A Kami seya is an ancient Japanese castle tower, usually made of wood and built on the top of a mountain or hill. \n3. Finally, we need to understand how NSGA Kami Seya Base is related to these two things. NSGA Kami Seya Base is an open-source project that provides a general-purpose library for manipulating 2D geometric shapes using linear algebra, which can be used to build 3D computer graphics and animation. This library implements optimized geometry algorithms, such as the ones used in Kami Seya, a traditional Japanese castle tower. These algorithms help reduce computational time and memory usage, allowing users to create complex 3D scenes with minimal resources."
"NSGA Kami Seya Base is an open-source project."とか、予想通り、よくわからない答えが返ってきました。
上瀬谷基地についての情報を得るために、
Navy Information Operations Command (NIOC) Yokosuka, Japanのサイト
https://www.navifor.usff.navy.mil/Organization/Operational-Support/NIOC-Hawaii/NIOC-Hawaii-N3J-Department/About-Us/History/
や
Naval Computer and Telecommunications Station (NCTS) Yokosuka, Japanのサイト
https://www.navifor.usff.navy.mil/Organization/Operational-Support/NCTS-Far-East-Yokosuka/About-Us/History/
を読み込ませてから、同じ質問をしてみます。
こんな仕組み
The National Security Agency's Kami Seya (NSA-K) was a U.S. Navy facility located in Yokosuka, Japan which provided communication services to various naval units and agencies until it was disestablished in October 2014. It is known for being one of the first two National Security Agency (NSA) sites, the other being Fort Meade, Maryland. It was used during World War II as a Fleet Radio Unit, tracking enemy vessels and providing radio communications for U.S. naval forces in the Pacific Ocean area. The National Security Agency's Kami Seya (NSA-K) was a U.S. Navy facility located in Yokosuka, Japan which provided communication services to various naval units and agencies until it was disestablished in October 2014. It is known for being one of the first two National Security Agency (NSA) sites, the other being Fort Meade, Maryland. It was used during World War II as a Fleet Radio Unit, tracking enemy vessels and providing radio communications for U.S. naval forces in the Pacific Ocean area.
上瀬谷基地は、横須賀にあるとか、ちょっと間違っているところもありますが、かなり良い答えが返ってきました。
ChatGPTなどのLLMは、言語モデルだけでなく、言語モデルとテキストやPDF、Microsoft Word、Pandas DataFrame、Slackなどさまざまなデータソースと接続させたり、ユーザーの要求を「どのような手段を使ってどういう順番で解決するか」を 自動的に決定してくれるエージェントと呼ばれる機能と組み合わせる仕組みなどのエコシステムができていて、この分野の進化はまだまだ続きそうですね。
ベーリック・ホール
山手234番館
ホテルニューグランド
山下公園
最近話題のChatGPTなどのLLM (Large Language Models)の分野では、モデルの他に、LLMを利用してドキュメントの検索を行ったりチャットボットを作るための仕組みを提供するLangChainやLlamaIndexなどが公開されています。
LangChainが、普通のパソコン (大容量メモリやGPUが不要)でも動かせるGPT4ALLやLlama-cppをサポートした(参照: https://python.langchain.com/en/latest/modules/models/llms/integrations.html )ので、メモリ16GBのノートパソコンで、LLukas22/alpaca-native-7B-4bit-ggjt ( https://huggingface.co/LLukas22/alpaca-native-7B-4bit-ggjt )という4.2GBのサイズのモデルと組み合わせて動かしてみました。
# モデルのダウンロード from huggingface_hub import hf_hub_download Llama-cpp_MODEL_PATH = "ggjt-model.bin" # Download the model. hf_hub_download(repo_id="LLukas22/alpaca-native-7B-4bit-ggjt", filename=Llama-cpp_MODEL_PATH, local_dir=".") from langchain.llms import LlamaCpp from langchain import PromptTemplate, LLMChain # QA用のテンプレートを作る template = """ Question: {question} Answer: Let's think step by step. """ prompt = PromptTemplate(template=template, input_variables=["question"]) llm = LlamaCpp(model_path=Llama-cpp_MODEL_PATH) # NSGA上瀬谷基地について聞いてみます。 question = "What is the NSGA Kami seya base ?" llm_chain.run(question)
"1. First, we need to know what 'NSGA' stands for. It stands for Non-Standard Generalized Array. \n2. Next, we need to know what a 'Kami seya' is. A Kami seya is an ancient Japanese castle tower, usually made of wood and built on the top of a mountain or hill. \n3. Finally, we need to understand how NSGA Kami Seya Base is related to these two things. NSGA Kami Seya Base is an open-source project that provides a general-purpose library for manipulating 2D geometric shapes using linear algebra, which can be used to build 3D computer graphics and animation. This library implements optimized geometry algorithms, such as the ones used in Kami Seya, a traditional Japanese castle tower. These algorithms help reduce computational time and memory usage, allowing users to create complex 3D scenes with minimal resources."
"NSGA Kami Seya Base is an open-source project."とか、予想通り、よくわからない答えが返ってきました。
上瀬谷基地についての情報を得るために、
Navy Information Operations Command (NIOC) Yokosuka, Japanのサイト
https://www.navifor.usff.navy.mil/Organization/Operational-Support/NIOC-Hawaii/NIOC-Hawaii-N3J-Department/About-Us/History/
や
Naval Computer and Telecommunications Station (NCTS) Yokosuka, Japanのサイト
https://www.navifor.usff.navy.mil/Organization/Operational-Support/NCTS-Far-East-Yokosuka/About-Us/History/
を読み込ませてから、同じ質問をしてみます。
こんな仕組み
from langchain.embeddings import LlamaCppEmbeddings from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain.vectorstores import FAISS from langchain.document_loaders import TextLoader # Embeddingsの作成、LlamaCppEmbeddings関数は、CPUを利用する場合 # n_threadsでスレッド数を指定できる。 embeddings = LlamaCppEmbeddings(model_path=Llama-cpp_MODEL_PATH, n_ctx= 2048, n_threads = 8) from langchain.document_loaders import TextLoader # 上瀬谷基地に関するテキストの読み込み loader = TextLoader('data/kamiseya.txt') documents = loader.load() text_splitter = RecursiveCharacterTextSplitter( chunk_size = 1000, chunk_overlap = 50, length_function = len) docs = text_splitter.split_documents(documents) # テキストをFAISSで扱えるベクトルデータにする db = FAISS.from_documents(docs, embeddings) db.save_local("faiss_index") # Use llama-cpp as the LLM for langchain callback_manager = CallbackManager([StreamingStdOutCallbackHandler()]) llm = LlamaCpp( model_path=Llama-cpp_MODEL_PATH, n_ctx= 2048, callback_manager=callback_manager, verbose=True, use_mlock=True ) # 質問文とドキュメントのデータでQAができるようにする。 retriever = db.as_retriever() qa = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=retriever) response = qa.run(query) print(response)
The National Security Agency's Kami Seya (NSA-K) was a U.S. Navy facility located in Yokosuka, Japan which provided communication services to various naval units and agencies until it was disestablished in October 2014. It is known for being one of the first two National Security Agency (NSA) sites, the other being Fort Meade, Maryland. It was used during World War II as a Fleet Radio Unit, tracking enemy vessels and providing radio communications for U.S. naval forces in the Pacific Ocean area. The National Security Agency's Kami Seya (NSA-K) was a U.S. Navy facility located in Yokosuka, Japan which provided communication services to various naval units and agencies until it was disestablished in October 2014. It is known for being one of the first two National Security Agency (NSA) sites, the other being Fort Meade, Maryland. It was used during World War II as a Fleet Radio Unit, tracking enemy vessels and providing radio communications for U.S. naval forces in the Pacific Ocean area.
上瀬谷基地は、横須賀にあるとか、ちょっと間違っているところもありますが、かなり良い答えが返ってきました。
ChatGPTなどのLLMは、言語モデルだけでなく、言語モデルとテキストやPDF、Microsoft Word、Pandas DataFrame、Slackなどさまざまなデータソースと接続させたり、ユーザーの要求を「どのような手段を使ってどういう順番で解決するか」を 自動的に決定してくれるエージェントと呼ばれる機能と組み合わせる仕組みなどのエコシステムができていて、この分野の進化はまだまだ続きそうですね。
横浜のイルミネーション [ヨコハマ]
久しぶりに夜の都会に行きました。
横浜駅西口
みなとみらい
都会は、キラキラなイルミネーションで彩られる季節になりました。
郊外では、氷がキラキラ
こども自然公園の中池に氷が張りました。
横浜駅西口
みなとみらい
都会は、キラキラなイルミネーションで彩られる季節になりました。
郊外では、氷がキラキラ
こども自然公園の中池に氷が張りました。
すっかり赤くなりました [ヨコハマ]
こども自然公園の紅葉もすっかり赤くなりました。
先日、日産グローバル本社ギャラリーで見た真っ赤なスポーツカー
ダットサン フェアレディ 1500 (SP310)
1961年のモーターショーで発表され1962年10月に発売されたそうです。
1488cc OHV 71ps. 最大トルク11.5kgf-m
60年も前に、こんなカッコイイ車があったんですね。
以前、青山のホンダでみた
ホンダS800
こちらは、1966年1月発売
排気量は、791ccしかないけど、8,000rpmまで回せて出力は70ps
最大トルク6.7kgf-m
1960年代には、トヨタもトヨタ・スポーツ800というスポーツカーを販売していたり、60年代ってすごい時代だったんですね。
先日、日産グローバル本社ギャラリーで見た真っ赤なスポーツカー
ダットサン フェアレディ 1500 (SP310)
1961年のモーターショーで発表され1962年10月に発売されたそうです。
1488cc OHV 71ps. 最大トルク11.5kgf-m
60年も前に、こんなカッコイイ車があったんですね。
以前、青山のホンダでみた
ホンダS800
こちらは、1966年1月発売
排気量は、791ccしかないけど、8,000rpmまで回せて出力は70ps
最大トルク6.7kgf-m
1960年代には、トヨタもトヨタ・スポーツ800というスポーツカーを販売していたり、60年代ってすごい時代だったんですね。