Skip to content

Commit

Permalink
Merge pull request #68 from AWShtokoyo/main
Browse files Browse the repository at this point in the history
aws-neuron update
  • Loading branch information
kazuhitogo committed Feb 14, 2024
2 parents 1c09c89 + c7176fd commit 5fd3228
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ AWS で機械学習をはじめる方法を学ぶことができるリポジト
* 機械学習モデルの開発効率化やパイプライン化を検討している方が、 Amazon SageMaker をどう使えば実現できるか学ぶためのコンテンツ。
* `frameworks`
* すでに TensorFlow や PyTorch で開発している方が、モデルを SageMaker 上で学習、推論させるための移行方法を学ぶためのコンテンツ。
* `aws-neuron` AWSが設計した機械学習アクセラレーター AWS Trainium、AWS Inferentia を活用する方法を学ぶためのコンテンツ。
* `tasks`
* 画像のセグメンテーションや物体検知、自然言語処理のQAや要約など、個別具体的なタスクを SageMaker でどのように解けるか学ぶためのコンテンツ。
* `solutions`
Expand Down
50 changes: 38 additions & 12 deletions frameworks/aws-neuron/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# AWS NEURON JP


[AWS Trainium](https://aws.amazon.com/jp/machine-learning/trainium/)[AWS Inferentia](https://aws.amazon.com/jp/machine-learning/inferentia/) は、AWSが設計した機械学習アクセラレータで、クラウドで低コストでコスト効率の高い機械学習トレーニング、推論を可能にします。
[AWS Trainium](https://aws.amazon.com/jp/machine-learning/trainium/)[AWS Inferentia](https://aws.amazon.com/jp/machine-learning/inferentia/) は、AWSが設計した機械学習アクセラレーターで、クラウドで低コストでコスト効率の高い機械学習トレーニング、推論を可能にします。



Expand All @@ -19,7 +19,7 @@


## Amazon EC2 Inf2 インスタンス
[Amazon EC2 Inf2](https://aws.amazon.com/jp/ec2/instance-types/inf2/) インスタンスは、第 2 世代の AWS Inferentia アクセラレータである AWS Inferentia2 を搭載しています。Inf1 インスタンスと比較し、最大 3 倍のコンピューティングパフォーマンス、最大 4 倍のアクセラレーターメモリ、最大 4 倍のスループット、10 分の 1 以下の低レイテンシーを実現します。
[Amazon EC2 Inf2](https://aws.amazon.com/jp/ec2/instance-types/inf2/) インスタンスは、第 2 世代の AWS Inferentia アクセラレーターである AWS Inferentia2 を搭載しています。Inf1 インスタンスと比較し、最大 3 倍のコンピューティングパフォーマンス、最大 4 倍のアクセラレーターメモリ、最大 4 倍のスループット、10 分の 1 以下の低レイテンシーを実現します。
AWS Trainium と同じ世代となる NeuronCore-v2 を搭載、推論だけではなく、小規模モデルのファインチューニングも実行可能です。


Expand All @@ -40,25 +40,51 @@ AWS Trainium と同じ世代となる NeuronCore-v2 を搭載、推論だけで
> [!NOTE]
> コンテンツは Jupyter Nodebook 形式で提供しています。Jupter Notebook 環境のセットアップ方法は[こちら](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/general/setup/notebook/setup-jupyter-notebook-steps-troubleshooting.html)をご参照下さい。

## :books: グローバルコンテンツ

* https://awsdocs-neuron.readthedocs-hosted.com/en/latest/general/arch/model-architecture-fit.html
* AWS Trainium、AWS Inferentia が対応しているモデル、得意不得意なモデルに関してはこちらのドキュメントをご参照下さい。
* https://github.com/aws-neuron/aws-neuron-samples/
* This repository contains samples for AWS Neuron, the software development kit (SDK) that enables machine learning (ML) inference and training workloads on the AWS ML accelerator chips Inferentia and Trainium.
* このリポジトリでは、AWS MLアクセラレーターチップ Inferentia と Trainium 上で機械学習推論とトレーニングワークロードを実行する AWS Neuron のサンプルスクリプト(Nodebook)を提供しています。
* https://github.com/aws-samples/ml-specialized-hardware
* In this tutorial you'll learn how to use AWS Trainium and AWS Inferentia with Amazon SageMaker and Hugging Face Optimum Neuron, to optimize your ML workloads
* このワークショップでは、AWS Trainium AWS Inferentia Amazon SageMaker Hugging Face Optimum Neuron と一緒に使用して ML ワークロードを最適化する方法を学びます。
* https://github.com/huggingface/optimum-neuron
* 🤗 Optimum Neuron is the interface between the 🤗 Transformers library and AWS Accelerators including AWS Trainium and AWS Inferentia. It provides a set of tools enabling easy model loading, training and inference on single- and multi-Accelerator settings for different downstream tasks.
* 🤗 Optimum Neuron は、Hugging Face が提供する 🤗 Transformers ライブラリと AWS Trainium や AWS Inferentia などの AWS アクセラレーターとの間のインターフェースです。さまざまなダウンストリームタスクに対してシングル及びマルチアクセラレーターを用いた、モデルの読み込み、トレーニング、推論を簡単に行うためのツールセットを用意しています。検証されたモデルとタスクのリストは、[こちらから](https://huggingface.co/docs/optimum-neuron/package_reference/configuration#supported-architectures)ご覧いただけます。また各種チュートリアルを用意しています。
* [Create your own chatbot with llama-2-13B on AWS Inferentia](https://huggingface.co/docs/optimum-neuron/tutorials/llama2-13b-chatbot)
* [Generate images with Stable Diffusion models on AWS Inferentia](https://huggingface.co/docs/optimum-neuron/tutorials/stable_diffusion)
* [Fine-tune and Test Llama 2 7B on AWS Trainium](https://huggingface.co/docs/optimum-neuron/tutorials/fine_tune_llama_7b)
* [Fine-tune BERT for Text Classification on AWS Trainium](https://huggingface.co/docs/optimum-neuron/tutorials/fine_tune_bert)


## 🧑‍🤝‍🧑 活用事例

2023年7月に開始した「[AWS LLM 開発支援プログラム](https://aws.amazon.com/jp/local/llm-development-support-program/)」では、基盤モデル開発に挑む 17 社を採択、そのうちの多くが AWS Trainium (Amazon EC2 Trn1 インスタンス)を活用してモデルの開発を行いました。

関連記事

* 2024/02/06 (MONOist) [リコーが130億パラメーターの日英対応LLM開発 AWSジャパンの支援プログラム活用](https://monoist.itmedia.co.jp/mn/articles/2402/06/news075.html)
* 2024/02/01 (EnterpriseZine) [「今年は生成AIの社会実装の年に」と経産省、AWS LLM開発支援プログラムの成果発表会で](https://enterprisezine.jp/news/detail/19146)

参加企業からのPR、技術ブログ

* 2024/02/02 (Watashiha様) inf2用推論スクリプトおよびコンパイル済みモデルを公開(公開モデル [Watashiha-Llama-2-13B-Ogiri-sft-neuron](https://huggingface.co/watashiha/Watashiha-Llama-2-13B-Ogiri-sft-neuron))
* 2024/01/31 (RICOH様) [日本語精度が高い130億パラメータの大規模言語モデル(LLM)を開発](https://jp.ricoh.com/release/2024/0131_1)
* 2024/01/31 (カラクリ様) [カラクリ、700億パラメーターLLM「KARAKURI LM」を一般公開](https://karakuri.ai/seminar/news/karakuri-lm/) (公開モデル [karakuri-lm-70b-v0.1](https://huggingface.co/karakuri-ai/karakuri-lm-70b-v0.1) / [karakuri-lm-70b-chat-v0.1](https://huggingface.co/karakuri-ai/karakuri-lm-70b-chat-v0.1))
* 2024/01/25 (Watashiha様) Llama2-13bに日本語語彙を追加して継続事前学習を行った大喜利言語モデルを公開 (公開モデル [Watashiha-Llama-2-13B-Ogiri-sft](https://huggingface.co/watashiha/Watashiha-Llama-2-13B-Ogiri-sft))
* 2024/01/25 (カラクリ様) [カラクリの700億パラメーターLLM、国産モデルの中で最高性能を獲得](https://karakuri.ai/seminar/news/aws_llm-2/)
* 2024/01/21 (Stockmark様) Inf2用推論スクリプトを公開 ([inferentia2.ipynb](https://huggingface.co/stockmark/stockmark-13b/blob/main/notebooks/inferentia2.ipynb))
* 2023/12/21 (rinna様) [rinna、Qwenの日本語継続事前学習モデル「Nekomata」シリーズを公開](https://rinna.co.jp/news/2023/12/20231221.html) (公開モデル [nekomata-14b](https://huggingface.co/rinna/nekomata-14b))
* 2023/10/26 (Stockmark様) [ビジネスのドメインや最新情報に対応した130億パラメータの日本語LLMの公開](https://tech.stockmark.co.jp/blog/202310_stockmark_13b/) (公開モデル [stockmark-13b](https://huggingface.co/stockmark/stockmark-13b))


## 📝 注目コンテンツ

* Llama2 7B/13B (学習)
* [Llama2 pretraining job using neuronx-nemo-megatron](https://github.com/aws-neuron/aws-neuron-parallelcluster-samples/blob/master/examples/jobs/neuronx-nemo-megatron-llamav2-job.md)
* Llama2 7B/13B (推論 - テキスト生成)
* [Llama2 autoregressive sampling using transformers-neuronx](https://github.com/aws-neuron/aws-neuron-samples/blob/master/torch-neuronx/transformers-neuronx/inference/meta-llama-2-13b-sampling.ipynb)
* Stable Diffusion (推論 - 画像生成)
* Llama2
* AWSブログ: [AWS Inferentia と AWS Trainium を用いた、AWS SageMaker JumpStart によるコスト最適化された Llama 2 モデルのファインチューニングとデプロイ](https://aws.amazon.com/jp/blogs/news/fine-tune-and-deploy-llama-2-models-cost-effectively-in-amazon-sagemaker-jumpstart-with-aws-inferentia-and-aws-trainium/)
* [AWS Neuron Reference for NeMo Megatron ライブラリを用いた事前学習チュートリアル](https://github.com/aws-neuron/aws-neuron-parallelcluster-samples/blob/master/examples/jobs/neuronx-nemo-megatron-llamav2-job.md)
* [Neuron Distributed ライブラリを用いた事前学習チュートリアル](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/libraries/neuronx-distributed/tutorials/training_llama2_tp_pp.html)
* [推論 - テキスト生成サンプル](https://github.com/aws-neuron/aws-neuron-samples/blob/master/torch-neuronx/transformers-neuronx/inference/meta-llama-2-13b-sampling.ipynb)

* Stable Diffusion
* AWSブログ: [AWS Inferentia2 で Stable Diffusion のパフォーマンスを最大化し、推論コストを削減する](https://aws.amazon.com/jp/blogs/news/create-high-quality-images-with-stable-diffusion-models-and-deploy-them-cost-efficiently-with-amazon-sagemaker/)
* [HuggingFace Stable Diffusion 1.5 (512x512)](https://github.com/aws-neuron/aws-neuron-samples/blob/master/torch-neuronx/inference/hf_pretrained_sd15_512_inference.ipynb)
* [HuggingFace Stable Diffusion 2.1 (512x512)](https://github.com/aws-neuron/aws-neuron-samples/blob/master/torch-neuronx/inference/hf_pretrained_sd2_512_inference.ipynb)
Expand Down

0 comments on commit 5fd3228

Please sign in to comment.