#author("2020-02-07T12:22:02+00:00","","")
#author("2020-02-10T12:14:35+00:00","","")
#mynavi(AWSメモ)
#setlinebreak(on);

* 概要 [#t3a6f1d5]
#html(<div class="pl10">)

#TODO

基本的に、以下のチュートリアルに沿って実施する。
基本的に、以下のチュートリアルを参考に実施する。
https://aws.amazon.com/jp/getting-started/tutorials/build-train-deploy-machine-learning-model-sagemaker/
https://docs.aws.amazon.com/ja_jp/sagemaker/latest/dg/pytorch.html
https://sagemaker.readthedocs.io/en/stable/using_pytorch.html

#html(</div>)


* 目次 [#lbcbf722]
#contents
- 関連
-- [[ディープラーニング入門]]
-- [[TensorFlow入門]]
-- [[Keras入門]]
-- [[Chainer入門]]
-- [[PyTorch入門]]
-- [[numpy入門]]
-- [[pandas入門]]

* notebook instance の作成 [#b768243f]
#html(<div class="pl10">)

Amazon SageMaker コンソールから [[ノートブックインスタンス:https://ap-northeast-1.console.aws.amazon.com/sagemaker/home?region=ap-northeast-1#/notebook-instances]] に移動後、[ノートブックインスタンスの作成] を押下して作成する。

今回は以下の通り作成した。
※以下に記載のないものは、全て未選択 または デフォルト値で作成した。

| 設定名 | 設定内容 | 補足 |h
| ノートブックインスタンス名 | sample-notebook1 | |
| ノートブックインスタンスのタイプ | ml.t2.medium | |
| Elastic Inference | 今回は使用しない | 推論をガンガン行う場合は使用する(GPUが使える) |
| ライフサイクル設定 | なし | |
| ボリュームサイズ | 5GB | |
| IAM ロール | [新しいロールの作成]  から 作成 | 自分で作成する場合は "AmazonSageMakerFullAccess" もつ IAM ロールを作成する |
| IAM ロール | [新しいロールの作成]  から 作成 | 「任意の S3 バケット」へのアクセスを許可。 |
| ルートアクセス | 有効化 | |

しばらくするとステータスが [Pending] から [InService] に変わるので、しばらく待つ。

#html(</div>)

* データの準備 [#w537f9fc]
#html(<div class="pl10">)
#TODO

[Jupyter を開く] から jupyter notebook を開く。


#html(</div>)

* モデルのトレーニング [#m7a7a033]
#html(<div class="pl10">)
#TODO
#html(</div>)

* モデルのデプロイ [#c6a0ed9c]
#html(<div class="pl10">)
#TODO
#html(</div>)

* モデルの性能評価 [#da8e5421]
#html(<div class="pl10">)
#TODO
#html(</div>)

* 後片付け [#n4a10327]
#html(<div class="pl10">)
#TODO
#html(</div>)


#mycode2(){{
import torch
import os

def model_fn(model_dir):
    model = Your_Model()
    with open(os.path.join(model_dir, 'model.pth'), 'rb') as f:
        model.load_state_dict(torch.load(f))
    return model
}}

#mycode2(){{
# Deserialize the Invoke request body into an object we can perform prediction on
input_object = input_fn(request_body, request_content_type)

# Perform prediction on the deserialized object, with the loaded model
prediction = predict_fn(input_object, model)

# Serialize the prediction result into the desired response content type
output = output_fn(prediction, response_content_type)
}}


トップ   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS