We may earn an affiliate commission when you visit our partners.
Course image
Udemy logo

7ステップで作る日本語GPTスクラッチ開発ハンズオン

経知 神草

※2024/2/27にgoogleのGemmaのコードをローカル(実演はColab)で実行するハンズオン追加しました。

Read more

※2024/2/27にgoogleのGemmaのコードをローカル(実演はColab)で実行するハンズオン追加しました。

日本国内からAttentionを利用した新しい事前学習モデルのアーキテクチャを提案し、そのモデルで最高性能を上回ったというニュースはなく、「GPT-NeoX」「LLaMa2」など、その背後には事前学習済みの「Transformer」ベースの言語モデルをすでに海外の組織が開発を行い、その上で日本語で後から事後学習(ファインチューニングやRLHF)を行ったものがほとんどです。

これは1つには計算資源の問題がありますが、もう一つの問題としてそもそもTransformerベースの言語モデルを実装できるという人材が日本では非常に少ないというのがあります。

今後ますます熾烈な戦いが予想されるLLMの分野で、その背景となる技術「Transformer」に着目し、スクラッチで実装し事前学習(Next Token(Character) Prediction)できるようになっておくことは、日本からまたエキサイティングな技術を生み出せる礎になると考えております。そこで、私自身が深層学習・自然言語処理業界で長らく現役で研究開発を行ってきた知見・スキルを惜しげもなく詰め込んだ「7ステップで作る日本語GPTスクラッチ開発ハンズオン」を開講いたしました。

この講座では、Google Colab環境の煩雑なセットアップや難しい環境構築の心配をせずに、現在大注目のChatGPTの魔法を解き明かす7つのステップをご案内します。更におまけとしてXwin-LM-13bやElyza-llama2の量子化されたバージョンをGoogle Colabから呼び出しソースコードを自動生成するハンズオンも実施いたします。その他「Zephyr 7b Alpha」に関しても実行するハンズオンを行っていきます。

Step 1: Google Colaboratoryのセットアップ まずは煩雑な環境構築の心配をせずに、Google Colabをセットアップしましょう。手軽に始めることができるため、学習を始めるハードルを下げます。

Step 2: 青空文庫の夏目漱石「吾輩は猫である」をBeautifulSoupでWebスクレイピング 実際のテキストデータを扱い、自然言語処理の基本を学びます。BeautifulSoupを使用してテキストを取得し、次のステップに備えます。

Step 3: 自然言語処理(正規表現・形態素解析・エンコーディング・デコーディング・訓練データ作成) テキストの前処理を通じて、正規表現や形態素解析の技術をマスターします。テキストデータを適切な形に整え、トークン化します。

Step 4: Bigram(2-gram)言語モデルの実装解説 基本的な言語モデルを実装するステップです。Bigramモデルを通じて、単語の連続性を理解し、テキスト生成の基本原則に触れます。

Step 5: Attentionを計算するための数学的トリック(行列計算、トライアングル) Transformerモデルの魔法の一部であるAttentionメカニズムを理解するために、行列計算やtorch.tril()について学びます。

Step 6: Self-Attentionの実装 Self-Attentionメカニズムを実装し、トークン間の関係性を捉える方法を理解します。これはTransformerの中核です。

Step 7: Multi-Head Attention/Positional Encoding/GPTの実装・訓練・推論 最終ステップでは、Multi-Head AttentionやPositional Encodingを組み合わせて、GPTモデルを実装、訓練、推論します。ChatGPTの中身を理解し、自分自身でもテキスト生成モデルを作成できる力を身につけます。

(おまけ)"TheBloke/Xwin-LM-70B-V0.1-GPTQ"を扱う

Xwin-LMをhuggingfaceライブラリを使用して呼び出し、Colab環境で日本語によるソースコード生成ができるようになります。

(おまけ)"ELYZA-japanese-Llama-2-7b-fast-instruct-GPTQ-calib-ja-2k"と"HuggingFaceH4/zephyr-7b-alpha"を扱う

huggingfaceライブラリを"ELYZA-japanese-Llama-2-7b-fast-instruct-GPTQ-calib-ja-2k"と"HuggingFaceH4/zephyr-7b-alpha"を使用して呼び出し、Colab環境で物語生成やソースコード生成ができるようになります。

(おまけ)OpenAIのAPIアップデート(2024/1/25) をフル活用したRAGシステムの実装方法 text-embedding-3-smallとgpt-4-0125-previewを使ったRAG(Retrieval Augmentation Generation)で自社テキストから回答させる実装を20分で解説します。

この講座は、Google Colab環境での手軽な学習を通じて、Transformerの核心概念を深く理解し、自然言語処理の世界に踏み込むためのものです。プログラミング初心者から経験豊富な開発者まで、どなたにもおすすめです。

ぜひUdemyで「7ステップで作るGPTスクラッチ開発ハンズオン」をご覧いただき、Transformerの実装と自然言語処理の興奮を体験してください!

Enroll now

What's inside

Syllabus

紹介
Google ColaboratoryのセットアップしてPythonを実行できるようになります。
Google Colaboratoryで新規ノートブックを作成する。
日本語のデータをWebスクレイピングして取得できるようになる。
Read more
BeutifulSoupでWebスクレイピング
テキストデータの前処理を通じて自然言語処理の基礎を学ぶ
正規表現・形態素解析・カタカナひらがな変換を利用してテキストを前処理する。
エンコーディング
デコーディング
訓練データ・テストデータの分割
大規模言語モデル(LLM)用訓練データに変換・GPU有効化
Pytorchのnn.Moduleを利用してBigramモデルを定義し訓練できるようになります。
Bigramモデルの実装
Bigramモデルの訓練
Bigramモデルの訓練2
Attentionの計算を行うための実装の考え方(数学的トリック)がわかるようになる。
11_Attention準備編_言語モデルの説明
行列演算による計算の効率化
Step.6 Self-Attentionの考え方がわかり実装できるようになることを目指します。
Self-Attentionの実装
Positional Encoding, MultiHead Attention,
Multi-Head Attention/Positional Encoding/GPTの実装・訓練・推論
形態素解析を行い単語の表層系ベースに夏目漱石風の文章を生成するGPTを訓練・推論できるようになります。
単語ベース(表層系)ベースのGPT

kunishou/databricks-dolly-15k-jaを使って表層系で事前学習してみます。

言語モデルの歴史的経緯とPositional Encodingの必要性
Positional Encodingソース説明
LLaMa2の派生形で高精度・軽量な言語モデルを試します。
Xwin-LM

Elyza-japanese-Llama-2-7b-fast-instructをGPTQで量子化したモデルと、Zephyr-7bのモデルのGoogle Colaboratory無料版で動作させるハンズオンです。

※2023/10/21時点で動作確認しておりますが動作を保証するものではございませんので、ご留意ください。バージョンの組み合わせなどにより今後動作しなくなる可能性もございます。

Mixtral 8x7b をColab Freeで
スクラッチで最新のOpenAIモデルでRAGによるカスタムGPTを作る方法がわかります。
OpenAI 2024/1/25 UpdateとRAG
HuggingChatのAssistantsの使い方と作り方を解説します。
HuggingChat Assistantsとgpts
Mistral-NextをGradioで触っていきます。
Mistral-NextをGradioで試します。
Google GemmaをGoogle Colab内でローカルで動作できるようになります。
Google Gemma
Llama3/Command R+/GrokにCoTすると、それぞれどんな感じかがつかめます。
オープンソースの言語モデルはCoTがきくのか。

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Teaches learners about the core mathematical concepts behind Attention in Neural Networks, which may be foundational to many kinds of modeling
Explores innovative practices in the use of transformer-based language models, which are more computationally efficient than other current natural language processing models
Builds a solid knowledge base for learners by teaching them to understand the fundamentals of natural language processing and how to apply the transformer model in practice
Provides useful examples that walk learners through the process of creating advanced text generation models
Covers a broad range of topics related to text generation, including how to use the HuggingFace library, implement a GPT model, and generate text

Save this course

Save 7ステップで作る日本語GPTスクラッチ開発ハンズオン to your list so you can find it easily later:
Save

Activities

Coming soon We're preparing activities for 7ステップで作る日本語GPTスクラッチ開発ハンズオン. These are activities you can do either before, during, or after a course.

Career center

Learners who complete 7ステップで作る日本語GPTスクラッチ開発ハンズオン will develop knowledge and skills that may be useful to these careers:
Natural Language Processing Scientist
Natural Language Processing (NLP) Scientists leverage deep learning, statistical algorithms, and linguistics to develop processes for data cleaning, feature engineering, and model building. The concepts and techniques you learn in this hands-on course will equip you with a strong foundation in NLP concepts, providing you with the knowledge and skills required to build advanced language-based solutions.
Linguist
Linguists study the structure and meaning of language. They analyze how languages are used and develop theories to explain how they change over time. The course will help linguists gain experience with natural language processing and machine learning, which are essential skills for analyzing language data.
Data Scientist
Data Scientists use scientific methods, processes, algorithms, and systems to extract knowledge and insights from data. This course will provide you with a solid foundation in natural language processing and deep learning, which are essential skills for data scientists who work with text and language data.
Machine Learning Engineer
Machine Learning Engineers design, develop, and maintain machine learning models. This course will introduce you to the theory and practice of natural language processing, providing you with the skills you need to build and deploy machine learning models that can understand and generate human language.
Software Engineer
Software Engineers design, develop, and maintain software systems. This course will provide you with the skills you need to build and deploy natural language processing systems, which are in high demand across a variety of industries.
NLP Engineer
NLP Engineers specialize in natural language processing. They develop and implement NLP models and systems. They also work on research and development of new NLP technologies. This course will provide you with the skills and knowledge you need to become an NLP Engineer.
AI Researcher
AI Researchers conduct research in the field of artificial intelligence. They develop new theories and algorithms for solving problems in AI. This course will provide you with the skills and knowledge you need to become an AI Researcher who specializes in natural language processing.
Data Analyst
Data Analysts collect, clean, and analyze data to identify patterns and trends. This course will provide you with the skills you need to work with natural language data, which is a growing area of focus for data analysts.
Information Architect
Information Architects design and organize information systems. They work with users to understand their needs and then create systems that are easy to use and understand. This course will provide you with the skills you need to work with natural language data, which is a critical part of many information systems.
User Experience Designer
User Experience Designers design and evaluate user interfaces. They work to make sure that users have a positive experience when interacting with products and services. This course will provide you with the skills you need to work with natural language data, which is a critical part of many user interfaces.
Content Strategist
Content Strategists plan and create content for websites, blogs, and other digital platforms. They work to ensure that content is relevant, engaging, and effective. This course will provide you with the skills you need to work with natural language data, which is a critical part of content strategy.
Technical Writer
Technical Writers create documentation for software, hardware, and other technical products. They work to ensure that documentation is clear, accurate, and easy to understand. This course will provide you with the skills you need to work with natural language data, which is a critical part of technical writing.
Marketing Manager
Marketing Managers plan and execute marketing campaigns. They work to promote products and services to target audiences. This course may provide you with some of the skills you need to work with natural language data, which is a growing area of focus for marketing managers.
Sales Manager
Sales Managers lead and motivate sales teams. They work to achieve sales goals and objectives. This course may provide you with some of the skills you need to work with natural language data, which is a growing area of focus for sales managers.
Customer Success Manager
Customer Success Managers work with customers to ensure that they are satisfied with products and services. They work to resolve issues and build relationships with customers. This course may provide you with some of the skills you need to work with natural language data, which is a growing area of focus for customer success managers.

Reading list

We've selected seven books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in 7ステップで作る日本語GPTスクラッチ開発ハンズオン.
統計的自然言語処理の基礎を網羅的に解説しています。自然言語処理の数学的基盤を理解するのに役立ちます。
音声言語処理の包括的な本です。自然言語処理と音声認識の両方について扱っています。
ディープラーニングの包括的なガイドです。この本では、ディープラーニングの理論的背景、さまざまなディープラーニングモデル、およびそれらの応用について詳しく説明しています。
ディープラーニングの包括的な入門書です。自然言語処理の章もあり、基礎から応用まで幅広く扱っています。
ディープラーニングの基礎を理解し、Pythonを使用してディープラーニングモデルを構築するために必要な概念と実践的なガイダンスを提供します。この本は、Transformerモデルの実装を開始する前に、ディープラーニングの基礎を築くために役立ちます。
ディープラーニングの基礎から応用までをわかりやすく解説しています。自然言語処理の章もあり、Transformerモデルについても触れています。

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Here are nine courses similar to 7ステップで作る日本語GPTスクラッチ開発ハンズオン.
【初心者向け】大規模言語モデルにおけるRAGを実装できるようになろう!Webページの情報を元に回答できるAIを作ろう...
Most relevant
BERTによる自然言語処理を学ぼう! ...
Most relevant
LangChainによる大規模言語モデル(LLM)アプリケーション開発入門―GPTを使ったチャットボットの実装まで
Most relevant
【Stripe決済実践】Next.jsとSupabaseで動画レッスン販売アプリを作りながらStripeを学ぶ実践講...
Most relevant
ChatGPTのAPIで5つのアプリを作ってみよう!JSON生成、属性抽出、独自文書Q&A、SQL生成、AIエージェ...
Most relevant
【フォーム開発実践】認証やお問い合わせフォームをNext.js/RHF/zod等のモダン技術を使って開発する実践講座
Most relevant
【No2コース...
Most relevant
"使える英語"を身に付けるための英語上達ロードマップ
Most relevant
英語リスニング力UP! 【日本人のためのアメリカ英語発音講座 Vol.1】
Most relevant
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser