Skip to content

ClasCat® AI Research

クラスキャット – 生成 AI, AI エージェント, MCP

Menu
  • ホーム
    • ClassCat® AI Research ホーム
    • クラスキャット・ホーム
  • OpenAI API
    • OpenAI Python ライブラリ 1.x : 概要
    • OpenAI ブログ
      • GPT の紹介
      • GPT ストアの紹介
      • ChatGPT Team の紹介
    • OpenAI platform 1.x
      • Get Started : イントロダクション
      • Get Started : クイックスタート (Python)
      • Get Started : クイックスタート (Node.js)
      • Get Started : モデル
      • 機能 : 埋め込み
      • 機能 : 埋め込み (ユースケース)
      • ChatGPT : アクション – イントロダクション
      • ChatGPT : アクション – Getting started
      • ChatGPT : アクション – アクション認証
    • OpenAI ヘルプ : ChatGPT
      • ChatGPTとは何ですか?
      • ChatGPT は真実を語っていますか?
      • GPT の作成
      • GPT FAQ
      • GPT vs アシスタント
      • GPT ビルダー
    • OpenAI ヘルプ : ChatGPT > メモリ
      • FAQ
    • OpenAI ヘルプ : GPT ストア
      • 貴方の GPT をフィーチャーする
    • OpenAI Python ライブラリ 0.27 : 概要
    • OpenAI platform
      • Get Started : イントロダクション
      • Get Started : クイックスタート
      • Get Started : モデル
      • ガイド : GPT モデル
      • ガイド : 画像生成 (DALL·E)
      • ガイド : GPT-3.5 Turbo 対応 微調整
      • ガイド : 微調整 1.イントロダクション
      • ガイド : 微調整 2. データセットの準備 / ケーススタディ
      • ガイド : 埋め込み
      • ガイド : 音声テキスト変換
      • ガイド : モデレーション
      • ChatGPT プラグイン : イントロダクション
    • OpenAI Cookbook
      • 概要
      • API 使用方法 : レート制限の操作
      • API 使用方法 : tiktoken でトークンを数える方法
      • GPT : ChatGPT モデルへの入力をフォーマットする方法
      • GPT : 補完をストリームする方法
      • GPT : 大規模言語モデルを扱う方法
      • 埋め込み : 埋め込みの取得
      • GPT-3 の微調整 : 分類サンプルの微調整
      • DALL-E : DALL·E で 画像を生成して編集する方法
      • DALL·E と Segment Anything で動的マスクを作成する方法
      • Whisper プロンプティング・ガイド
  • Gemini API
    • Tutorials : クイックスタート with Python (1) テキスト-to-テキスト生成
    • (2) マルチモーダル入力 / 日本語チャット
    • (3) 埋め込みの使用
    • (4) 高度なユースケース
    • クイックスタート with Node.js
    • クイックスタート with Dart or Flutter (1) 日本語動作確認
    • Gemma
      • 概要 (README)
      • Tutorials : サンプリング
      • Tutorials : KerasNLP による Getting Started
  • Keras 3
    • 新しいマルチバックエンド Keras
    • Keras 3 について
    • Getting Started : エンジニアのための Keras 入門
    • Google Colab 上のインストールと Stable Diffusion デモ
    • コンピュータビジョン – ゼロからの画像分類
    • コンピュータビジョン – 単純な MNIST convnet
    • コンピュータビジョン – EfficientNet を使用した微調整による画像分類
    • コンピュータビジョン – Vision Transformer による画像分類
    • コンピュータビジョン – 最新の MLPモデルによる画像分類
    • コンピュータビジョン – コンパクトな畳込み Transformer
    • Keras Core
      • Keras Core 0.1
        • 新しいマルチバックエンド Keras (README)
        • Keras for TensorFlow, JAX, & PyTorch
        • 開発者ガイド : Getting started with Keras Core
        • 開発者ガイド : 関数型 API
        • 開発者ガイド : シーケンシャル・モデル
        • 開発者ガイド : サブクラス化で新しい層とモデルを作成する
        • 開発者ガイド : 独自のコールバックを書く
      • Keras Core 0.1.1 & 0.1.2 : リリースノート
      • 開発者ガイド
      • Code examples
      • Keras Stable Diffusion
        • 概要
        • 基本的な使い方 (テキスト-to-画像 / 画像-to-画像変換)
        • 混合精度のパフォーマンス
        • インペインティングの簡易アプリケーション
        • (参考) KerasCV – Stable Diffusion を使用した高性能画像生成
  • TensorFlow
    • TF 2 : 初級チュートリアル
    • TF 2 : 上級チュートリアル
    • TF 2 : ガイド
    • TF 1 : チュートリアル
    • TF 1 : ガイド
  • その他
    • 🦜️🔗 LangChain ドキュメント / ユースケース
    • Stable Diffusion WebUI
      • Google Colab で Stable Diffusion WebUI 入門
      • HuggingFace モデル / VAE の導入
      • LoRA の利用
    • Diffusion Models / 拡散モデル
  • クラスキャット
    • 会社案内
    • お問合せ
    • Facebook
    • ClassCat® Blog
Menu

TensorFlow による RNN : Character-Level 言語モデルの実装

Posted on 09/08/2016 by Sales Information

TensorFlow による Character-Level 言語モデル

RNN & Character-Level 言語モデル

RNN による言語モデルについても少し試しておきます。
以下は TensorFlow のチュートリアルでも参照されている、Stanford の Andrej Karpathy(現在は OpenAI らしい)による RNN の紹介記事ですが :

The Unreasonable Effectiveness of Recurrent Neural Networks

 
この中で Character-Level 言語モデルが紹介されています。

We’ll train RNN character-level language models. That is, we’ll give the RNN a huge chunk of text and ask it to model the probability distribution of the next character in the sequence given a sequence of previous characters. This will then allow us to generate new text one character at a time.

ついでに python による簡単な実装例も示されています :

Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy

TensorFlow による Character-Level 言語モデルの実装

そして TensorFlow で実装するのですが、実際には A. Karpathy の Torch による実装があるのでそちらを参考にしています。character-level 言語モデルで訓練/サンプリングするためのマルチ層の Recurrent Neural Network (RNN, LSTM そして GRU) を実装していて、具体的にはモデルは一つのテキストファイルを入力として、sequence の次の文字を predict することを学習する RNN を訓練します。
(試した限りでは LSTM よりも GRU の方が良い感じでした。)

題材としては取りあえず、Gutenberg から子供向けの古代エジプトについての歴史書を選んでみました。

で、訓練開始。最初のサンプリングはもちろん意味不明 :

z5L8JqA7ôPPêN:t,yUXaw!7.6àÔâ"ç:Uï7Büâœæàbôæ8XZ46:ï6Z*L MX1ïrâ4JÔôü5.GU8œ8Wê[5çtz.yuMfAt7GToüâPbL"9TzZEUXNmMzzqüæq4UzK*ïG7Dïb4ZZ]ôÔXŒïUâMïæfXWPÔ4'ês4êj6êbGU8MA°]ôêœWZUXWïôZFôJà4ôGYOüPA4âNA4ôPGçT*NZê(übob_KnUtw!Uz8üvfUG9 PT_âwé")kb:0"ôMôG:ÔUDâ.zKdTZoP(AXr?,ôUZ4SiXïU*f"s4WÔqü"564](_4àbUÏZzb4ôXp7_LW",HLkT(,8rxübïôUWbUæZpZrX7.TMWê_X,K(DASELGTü_JPTi5âzGb3PzUHvë44ôzfrMô8ræPtXÔUôbM,UjXê"êi4J3Xdüzlé4,P.WÔP-ôL"ÏU*ZêufrZut'z]"4ék?7âRMï6ô_D*oE4M5ï"o1wUHïP,tê:qqâ7

200 epochs。単語としては成立していますが、英語としてはいまいち…

"Herow? We may be proved the Greek lines for Mamessioh, the hands fall into complete determining
roubt what it was slow thee, under Tigolathy, engradus the month, 12, the trade had
regulication with a more inclier feet; which is consuit and involved,
   Whit heart vine upon the Hittite people of the god and in
mystery, and a pezit of a sixteen three more enjoyovies.

The east the government of "Harehæ). The march. The face
of the monarch remained below the two favous. He hadbendy that h

250 epochs。少し英語らしくなってきた?

In whohe,

           And two Nile Egypt, Psamatik had
the Levinites from their monument to land in different broadling the
blossom of the Egyptian conqueror.

   I came which determined, and had carried had
probably beauty and remove mid. The production of Assour, a
general towns reducted the King"--campte a point of each of his wife and brought
between the circumstances of his others, and to have been the dimensions
war, with difficues of Lakes, Naphuled, and hasing his bounth fine

Ablimn the bas a long god-gual-cylem in expedition, the missult
fronty of kings received afterwards amperiescent feet, and we must, must expenditues
that revolt at Karnak was barbarly one of Caired and Greek might be respected to
very remaining a period may be more him and to cut confine it, in his
worst, a deities of the western city of men cometthing of enarxer till shall be calamities
that here indeed in it thought taken pillarners, between their pas

500 epochs。このモデルではこのあたりが限界でしょうか :

 Egypt
possistration obtaining his limbs, lief force. The same monarch
were told as much invade brich emblec, and to make all the purpose of all period. The like took off the
artigious smaller commonly to ultime a hast to the good delights.
  Let stand who were modern Asiatic doing countries will but a
fewer hundred _shupps and Shumad Bœlusaa, Skirwaan; no one-who
had ever pieces is cut and left between the
Greek nine sides traverse, a certain pure, you adm; but
man had been remotle. Pent

The two hordes the first chariots landed history Esya-space of the
Nile in the crown of Egyptian terrible hand, in the jude timed Horuss to south herself. xpresidrages of
successure strengthen after a live death, and all their cities labour is a considerable
establishment of the podtis foreshonous, the Arab to Tash and in the imagine
food; and a residence Ramesses, came long, and forty numerous in 56°z,
in his kindlim, and after ordered the piece of the Nile, much to the sea, 

 which
make it scarcely skin a bettive grew lakes of the other." It is designated
his general. Antefaadich cemertions must advantage of the number, there were
models, or with the sovereignty of Sheshom and Shabak. The head
of considerable quiltly ashess fell into the other wind submitted by
maintain matiries in each year and Cyrus in the old temple battle--Egypt. Only further
recounces who had like agels out at an indecener and accomplishez, and
the first limbuted had yet reigned and carri

 
以上

クラスキャット

最近の投稿

  • LangGraph 0.5 : エージェント開発 : エージェントの実行
  • LangGraph 0.5 : エージェント開発 : prebuilt コンポーネントを使用したエージェント開発
  • LangGraph 0.5 : Get started : ローカルサーバの実行
  • LangGraph 0.5 on Colab : Get started : human-in-the-loop 制御の追加
  • LangGraph 0.5 on Colab : Get started : Tavily Web 検索ツールの追加

タグ

AutoGen (13) ClassCat Press Release (20) ClassCat TF/ONNX Hub (11) DGL 0.5 (14) Eager Execution (7) Edward (17) FLUX.1 (16) Gemini (20) HuggingFace Transformers 4.5 (10) HuggingFace Transformers 4.6 (7) HuggingFace Transformers 4.29 (9) Keras 2 Examples (98) Keras 2 Guide (16) Keras 3 (10) Keras Release Note (17) Kubeflow 1.0 (10) LangChain (45) LangGraph (24) MediaPipe 0.8 (11) Model Context Protocol (16) NNI 1.5 (16) OpenAI Agents SDK (8) OpenAI Cookbook (13) OpenAI platform (10) OpenAI platform 1.x (10) OpenAI ヘルプ (8) TensorFlow 2.0 Advanced Tutorials (33) TensorFlow 2.0 Advanced Tutorials (Alpha) (15) TensorFlow 2.0 Advanced Tutorials (Beta) (16) TensorFlow 2.0 Guide (10) TensorFlow 2.0 Guide (Alpha) (16) TensorFlow 2.0 Guide (Beta) (9) TensorFlow 2.0 Release Note (12) TensorFlow 2.0 Tutorials (20) TensorFlow 2.0 Tutorials (Alpha) (14) TensorFlow 2.0 Tutorials (Beta) (12) TensorFlow 2.4 Guide (24) TensorFlow Deploy (8) TensorFlow Get Started (7) TensorFlow Graphics (7) TensorFlow Probability (9) TensorFlow Programmer's Guide (22) TensorFlow Release Note (18) TensorFlow Tutorials (33) TF-Agents 0.4 (11)
2016年9月
月 火 水 木 金 土 日
 1234
567891011
12131415161718
19202122232425
2627282930  
« 8月   10月 »
© 2025 ClasCat® AI Research | Powered by Minimalist Blog WordPress Theme