Skip to content

Commit

Permalink
Update README.md and Contributing.md (#24)
Browse files Browse the repository at this point in the history
* Update README.md and Contributing.md
---------

Co-authored-by: Takahiro Kubo <ttaakkaa@amazon.co.jp>
  • Loading branch information
icoxfog417 and Takahiro Kubo committed Nov 21, 2023
1 parent 0d0ff04 commit d321dfb
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 139 deletions.
71 changes: 34 additions & 37 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,56 @@
# Contributing Guidelines

Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.
プレイグラウンドの開発への協力に関心を持っていただきありがとうございます。バグの報告、新機能の提案、それらの修正 / 実装、またドキュメントの充実にはコミュニティからの貢献が大きな力となります。

Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
information to effectively respond to your bug report or contribution.
Issue や Pull Request を送信する前にこのドキュメントをよく読み、必要な情報がすべて揃っていることを確認してください。

## Issue でバグの報告や新機能の提案を行う

## Reporting Bugs/Feature Requests
GitHub Issue を使用してバグを報告したり、新機能を提案したりすることを歓迎します。 Issue を起票する前に既存または解決済みの Issue を探すことで解決策が得られることがあるので、事前に確認をしてください。もしこれまで議論されておらず解決もされていない場合、 Issue Template に従い起票をしてください。できるだけ多くの情報を含めるようにしてください。次のような詳細は非常に役立ちます。

We welcome you to use the GitHub issue tracker to report bugs or suggest features.
* 再現可能なテストケースまたは一連のステップ
* 使用しているコードのバージョン
* バグに関連して行った変更
* 環境または展開に関する異常な点

When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
## Pull Request で貢献する

* A reproducible test case or series of steps
* The version of our code being used
* Any modifications you've made relevant to the bug
* Anything unusual about your environment or deployment
Pull Request による貢献は大歓迎です。 Pull Request を送信する前に、次のことを確認してください。

1. *main* ブランチ上の最新のソースに対して作業しています。
2. 既存の Pull Request をチェックして、他の人がまだ問題に対処していないことを確認します。
3. 重要な作業について話し合うために Issue を開きます。あなたの時間を無駄にすることは望ましくありません。

## Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
次のボードを参照することで、バグ・追加要望の対応状況を参照することができます。

1. You are working against the latest source on the *main* branch.
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
[llmjp playground development board](https://github.com/orgs/llm-jp/projects/3)

To send us a pull request, please:
Pull Request を送信するには、次の手順を実行してください。開発環境の構築は [DEVELOPMENT.md](docs/DEVELOPMENT.md) を参照してください。

1. Fork the repository.
2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
3. Ensure local tests pass.
4. Commit to your fork using clear commit messages.
5. Send us a pull request, answering any default questions in the pull request interface.
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
1. 本リポジトリを Fork します (Commit 権限がある場合 Clone で構いません) 。
* 参考 : [forking a repository](https://help.github.com/articles/fork-a-repo/)
2. ソースを変更します。あなたが提案する修正に集中し変更してください。すべてのコードを再フォーマットしたりすると、変更に焦点を当てることが難しくなります。
3. ローカルでのテストにパスすることを確認します。
* ソースコードの成形 : `npm run lint`
4. 変更内容が明確なコミットメッセージでコミットし、 Fork したリポジトリに push します。
5. Fork したリポジトリの Pull Request の画面から、本リポジトリの `main` ブランチに対し Pull Request を作成します。
6. Pull Request に対しレビューを受けます。レビューが完了したらマージを行います。
* CI/CD の仕組みに関心ある場合は [CICD Setup](./docs/CICD_SETUP.md) をご参照ください。

GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
GitHub のガイドも参考にしてください [pull request の作成](https://docs.github.com/ja/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)

## 貢献できる Issue を見つける

## Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
[`good first issue` がついた Issue ](https://github.com/llm-jp/llm-jp-model-playground/labels/good%20first%20issue) は最初の貢献に適しています。自身に AWS やアプリケーション開発の知見がある場合、 `help wanted` がついた Issue をぜひサポートしてください。

## 行動規範

## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
opensource-codeofconduct@amazon.com with any additional questions or comments.
本プロジェクトの行動規範は、 [CONTRIBUTOR COVENANT CODE OF CONDUCT 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/) に基づきます。行動規範への違反を見つけた場合や規範に関する質問は `llm-jp@nii.ac.jp` までご連絡ください。

## セキュリティの報告について

## Security issue notifications
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
本プロジェクトについてセキュリティの脆弱性などを発見した場合は、 `llm-jp@nii.ac.jp` までご連絡ください。**決して Public な Issue で報告しないでください**

## ライセンス

## Licensing

See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
本プロジェクトのライセンスは [LICENSE](LICENSE) を参照してください。本プロジェクトへの貢献を行う際は、このライセンスの範囲内で利用可能なものであるかご確認をお願いいたします。例えば、本プロジェクトのライセンスよりも Limited なライセンスのソフトウェアやコードを含めることはできません。
63 changes: 28 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,80 @@
# LLM JP Model Playground

このレポジトリは、複数のモデルを SageMaker 上にデプロイしデモが行える Playground のサンプルコードです
本リポジトリでは、大規模言語モデルのプレイグラウンドを AWS で実装するためのコードを提供します。プレイグラウンドでは、プロンプトやパラメーターを変更した際のモデルの挙動を確認、記録することができます

![sc_lp.png](/imgs/sc_lp.png)

## 機能一覧

> :white_check_mark: ... 実装されている、:construction: ... まだ実装されていない
- :white_check_mark: Amazon SageMaker で LLM をデプロイ
- :white_check_mark: プロンプト / パラメーター入力、出力表示用 UI
- :construction: Fine-tuning 用のデータ収集
- :construction: Fine-tuning 用データのラベリング
- :construction: Fine-tuning の実行

## アーキテクチャ

このサンプルでは、フロントエンドは React を用いて実装し、静的ファイルは Amazon CloudFront + Amazon S3 によって配信されています。バックエンドには Amazon API Gateway + AWS Lambda、認証には Amazon Congito チャット履歴等の保存には Amazon DynamoDB を使用しています。また、LLM は Amazon SageMaker を使用します
プレイグラウンドのフロントエンドは [React](https://ja.react.dev/) で実装されています。静的ファイルは Amazon S3 に配置され、 Amazon CloudFront で配信されます。バックエンドの API は Amazon API Gateway + AWS Lambda で実装され、認証は Amazon Congito で行っています。チャット履歴等の保存には Amazon DynamoDB を使用しています。大規模言語モデルは Amazon SageMaker でホスティングしています

![arch.png](/imgs/arch.png)

## デプロイ

まず最初にリージョンを指定する。`g5.2xlarge` でデプロイする際は `us-west-2` などの対応リージョンを設定する。
本リポジトリのアプリケーションをデプロイするのに [AWS Cloud Development Kit](https://aws.amazon.com/jp/cdk/)(以降 CDK)が必要です。各環境での CDK のインストール方法は [AWS CDK Workshop](https://cdkworkshop.com/ja/15-prerequisites/100-awscli.html) の「必要条件」を参照ください。本リポジトリでは TypeScript を使っているため、 Python/.NET/Java/Go の環境構築は必要ありません。

リモートの環境を使用することで、お手元の PC に影響を与えずデプロイすることができます。 AWS のリモート開発環境である Cloud9 を使用したデプロイ方法については[動画](https://youtu.be/9sMA17OKP1k?si=XwEp7q6b_EXDBP3p)にまとめていますので、そちらを参考にデプロイしてください。

CDK のインストールができたらデプロイを開始します。はじめに、デプロイする AWS のリージョンを設定します。 GPU インスタンス (`g5.2xlarge` など ) に余裕がある `us-west-2` を推奨します。

Mac/Linux

```bash
export AWS_DEFAULT_REGION=us-west-2
```

[AWS Cloud Development Kit](https://aws.amazon.com/jp/cdk/)(以降 CDK)を利用してデプロイします。最初に、npm パッケージをインストールしてください。なお、全てのコマンドはルートディレクトリで実行してください。また、[こちらの動画](https://www.youtube.com/watch?v=9sMA17OKP1k)でもデプロイ手順を確認できます。

Windows
```bash
npm ci
set AWS_DEFAULT_REGION=us-west-2
```

CDK を利用したことがない場合、初回のみ [Bootstrap](https://docs.aws.amazon.com/ja_jp/cdk/v2/guide/bootstrapping.html) 作業が必要です。すでに Bootstrap された環境では以下のコマンドは不要です
本アプリケーションに必要な `npm` のパッケージをインストールします

```bash
npx -w packages/cdk cdk bootstrap
npm ci
```

このレポジトリで GitHub Actions を用いた CI/CD を利用する場合、用意されている Cloudformation テンプレートを利用して IAM 関連のセットアップを
自動で行うことができます。レポジトリを Clone したディレクトリにて、 `GitHub_ORG_NAME``GitHub_REPO_NAME` を適切に設定して以下のコマンドを実行してください。
※ コマンドの実行には適切な権限が必要です。
CDK を利用したことがない場合、初回のみ CDK 用のファイルを保存する Amazon S3 やデプロイに必要なアクセス権限を付与する IAM ロールを準備する [Bootstrap](https://docs.aws.amazon.com/ja_jp/cdk/v2/guide/bootstrapping.html) 作業が必要です。すでに Bootstrap された環境では以下のコマンドは不要です。

```bash
stack_name="oidc-setup"
aws cloudformation create-stack --capabilities CAPABILITY_NAMED_IAM --stack-name $stack_name --template-body file://oidc-setup.yaml --parameters ParameterKey=GithubOrg,ParameterValue=<GitHub_ORG_NAME> ParameterKey=RepoName,ParameterValue=<GitHub_REPO_NAME>

aws cloudformation wait stack-create-complete --stack-name $stack_name

outputs=$(aws cloudformation describe-stacks --stack-name $stack_name --query 'Stacks[0].Outputs' --output text)

echo "Stack Outputs:"
echo "$outputs"
npx -w packages/cdk cdk bootstrap
```
実行したターミナルに IAM Role の arn が出力されます。この後の手順で必要になるので、メモしておきます。
追加で GitHub 側での設定が必要です。追加の手続きは [/docs/CICD_SETUP.md](docs/CICD_SETUP.md##GitHub-側での設定) をご確認ください。

続いて、以下のコマンドで AWS リソースをデプロイします。デプロイが完了するまで、お待ちください(20 分程度かかる場合があります)。

```bash
npm run cdk:deploy
```

### モデル・リージョンの切り替え
## 開発

詳細は [/docs/SAGEMAKER.md](docs/SAGEMAKER.md) をご確認ください
本アプリケーションを修正する場合、 [DEVELOPMENT.md](docs/DEVELOPMENT.md) を参照し開発環境を構築してください。修正内容を本リポジトリに送っていただける場合は、 [CONTRIBUTING](CONTRIBUTING.md) を参照ください

## Pull Request を出す場合
次のボードを参照することで、バグ・追加要望の対応状況を参照することができます。

バグ修正や機能改善などの Pull Request は歓迎しております。コミットする前に、lint ツールを実行してください。
[llmjp playground development board](https://github.com/orgs/llm-jp/projects/3)

```bash
npm run lint
```

また、ローカル環境の構築手順については [/docs/DEVELOPMENT.md](/docs/DEVELOPMENT.md) をご確認ください。
### Release History

## Security
太字は終了した Release です。

See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
* 0.5.0 : プレイグラウンドから Fine Tuning したモデルに対しプロンプト / パラメーターの入出力ができるようにする
* 0.4.0 : プレイグラウンドから Fine Tuning を実行できるようにする
* 0.3.0 : プレイグラウンド上でデータの参照・修正機能を実装する
* 0.2.0 : プレイグラウンド上でのデータ収集機能を実装する
* [0.1.1](https://github.com/llm-jp/llm-jp-model-playground/milestone/2) : 新規開発メンバーが過大な請求や障害を起こすことなく開発できるガイド、仕組みを整える。
* [0.1.0](https://github.com/llm-jp/llm-jp-model-playground/milestone/1) : プロンプト / パラメーター入力、出力表示用 UI を実装する。

## License

This library is licensed under the MIT-0 License. See the LICENSE file.

20 changes: 0 additions & 20 deletions docs/BEDROCK.md

This file was deleted.

0 comments on commit d321dfb

Please sign in to comment.