

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# 組み込みアルゴリズムのパラメータ
<a name="common-info-all-im-models"></a>

次の表に、Amazon SageMaker AI によって提供される各アルゴリズムのパラメータを示します。


| アルゴリズム名 | チャンネル名 | トレーニング入力モード | ファイルタイプ | インスタンスクラス | 並列処理可能 | 
| --- | --- | --- | --- | --- | --- | 
| AutoGluon - 表形式 | トレーニング、および (オプションで) 検証 | システム | CSV | CPU または GPU (単一インスタンスのみ) | いいえ | 
| BlazingText | トレーニング | ファイルまたはパイプ | テキストファイル (1 行に 1 文、スペース区切りのトークンを含む)  | CPU または GPU (単一インスタンスのみ)  | いいえ | 
| CatBoost | トレーニング、および (オプションで) 検証 | システム | CSV | CPU (単一インスタンスのみ) | いいえ | 
| DeepAR 予測 | トレーニングおよび (オプションで) テスト | システム | JSON Lines または Parquet | CPU または GPU | はい | 
| 因数分解機 | トレーニングおよび (オプションで) テスト | ファイルまたはパイプ | recordIO-protobuf | CPU (高密度データ用の GPU) | はい | 
| 画像分類 - MXNet | トレーニングと検証、(オプションで) train\$1lst、validation\$1lst、およびモデル | ファイルまたはパイプ | recordIO またはイメージファイル (.jpg または .png)  | GPU | はい | 
| 画像分類 - TensorFlow | トレーニングおよび検証 | システム | 画像ファイル (.jpg、.jpeg、または .png)  | CPU または GPU | Yes (単一インスタンス上の複数の GPU 間でのみ) | 
| IP Insights | トレーニング、および (オプションで) 検証 | システム | CSV | CPU または GPU | はい | 
| K-Means | トレーニングおよび (オプションで) テスト | ファイルまたはパイプ | recordIO-protobuf または CSV | CPU または GPUCommon (1 つ以上のインスタンス上の単一の GPU デバイス) | いいえ | 
| K 近傍法 | トレーニングおよび (オプションで) テスト | ファイルまたはパイプ | recordIO-protobuf または CSV | CPU または GPU (1 つ以上のインスタンス上の単一の GPU デバイス) | はい | 
| LDA | トレーニングおよび (オプションで) テスト | ファイルまたはパイプ | recordIO-protobuf または CSV | CPU (単一インスタンスのみ) | いいえ | 
| LightGBM | トレーニングおよび (オプションで) 検証 | システム | CSV | CPU | はい | 
| 線形学習 | トレーニングおよび (オプションで) 検証、テスト、またはその両方 | ファイルまたはパイプ | recordIO-protobuf または CSV | CPU または GPU | はい | 
| ニューラルトピックモデル | トレーニングおよび (オプションで) 検証、テスト、またはその両方 | ファイルまたはパイプ | recordIO-protobuf または CSV | CPU または GPU | はい | 
| Object2Vec | トレーニングおよび (オプションで) 検証、テスト、またはその両方 | システム | JSON Lines  | CPU または GPU (単一インスタンスのみ) | いいえ | 
| オブジェクト検出 - MXNet | トレーニングと検証、(オプションで) train\$1annotation、validation\$1annotation、およびモデル | ファイルまたはパイプ | recordIO またはイメージファイル (.jpg または .png)  | GPU | はい | 
| オブジェクト検出 - TensorFlow | トレーニングおよび検証 | システム | 画像ファイル (.jpg、.jpeg、または .png)  | GPU | Yes (単一インスタンス上の複数の GPU 間でのみ) | 
| PCA | トレーニングおよび (オプションで) テスト | ファイルまたはパイプ | recordIO-protobuf または CSV | CPU または GPU | はい | 
| ランダムカットフォレスト | トレーニングおよび (オプションで) テスト | ファイルまたはパイプ | recordIO-protobuf または CSV | CPU | はい | 
| セマンティックセグメンテーション | トレーニングと検証、train\$1annotation、validation\$1annotation、および (オプションで) label\$1map およびモデル | ファイルまたはパイプ | 画像ファイル | GPU (単一インスタンスのみ) | いいえ | 
| Seq2Seq モデリング | トレーニング、検証、および vocab | システム | recordIO-protobuf | GPU (単一インスタンスのみ) | いいえ | 
| TabTransformer | トレーニングおよび (オプションで) 検証 | システム | CSV | CPU または GPU (単一インスタンスのみ) | いいえ | 
| テキスト分類 - TensorFlow | トレーニングおよび検証 | システム | CSV | CPU または GPU | Yes (単一インスタンス上の複数の GPU 間でのみ) | 
| XGBoost (0.90-1、0.90-2、1.0-1、1.2-1、1.2-21) | トレーニング、および (オプションで) 検証 | ファイルまたはパイプ | CSV、libsVM、または Parquet | CPU (または 1.2-1 の場合 GPU) | はい | 

*並列処理可能な*アルゴリズムは、トレーニングを分散するために、複数のコンピューティングインスタンスにデプロイできます。

次のトピックでは、Amazon SageMaker AI が提供するすべての組み込みアルゴリズムに共通のデータ形式、推奨される Amazon EC2 インスタンスタイプ、CloudWatch Logs に関する情報を提供します。

**注記**  
SageMaker AI が管理する組み込みアルゴリズムの Docker イメージ URI を検索するには、「[Docker Registry Paths and Example Code](https://docs.aws.amazon.com/sagemaker/latest/dg-ecr-paths/sagemaker-algo-docker-registry-paths)」を参照してください。

**Topics**
+ [トレーニングの共通データ形式](cdf-training.md)
+ [推論の共通データ形式](cdf-inference.md)
+ [組み込みアルゴリズムのインスタンスタイプ](cmn-info-instance-types.md)
+ [組み込みアルゴリズムのログ](common-info-all-sagemaker-models-logs.md)

# トレーニングの共通データ形式
<a name="cdf-training"></a>

トレーニングの準備として、 AWS Glue Amazon EMR、Amazon Redshift、Amazon Relational Database Service、Amazon Athena など、さまざまな AWS サービスを使用してデータを前処理できます。前処理の後、データを Amazon S3 バケットに発行します。トレーニングのために、データは次の一連の変換を経る必要があります。
+ トレーニングデータのシリアル化 (ユーザーによる処理) 
+ トレーニングデータの逆シリアル化 (アルゴリズムによる処理) 
+ トレーニングモデルのシリアル化 (アルゴリズムによる処理) 
+ トレーニング済みモデルの逆シリアル化 (オプション、ユーザーによる処理) 

アルゴリズムのトレーニングの部分で Amazon SageMaker AI を使用する場合は、必ずすべてのデータを一度にアップロードします。その場所により多くのデータが追加された場合は、新しいモデルを構築するために、新しいトレーニングの呼び出しが必要になります。

**Topics**
+ [組み込みアルゴリズムによってサポートされるコンテンツタイプ](#cdf-common-content-types)
+ [パイプモードを使用する](#cdf-pipe-mode)
+ [CSV 形式を使用する](#cdf-csv-format)
+ [RecordIO 形式を使用する](#cdf-recordio-format)
+ [トレーニング済みモデルの逆シリアル化](#td-deserialization)

## 組み込みアルゴリズムによってサポートされるコンテンツタイプ
<a name="cdf-common-content-types"></a>

次の表に、一般的にサポートされている [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_Channel.html#SageMaker-Type-Channel-ContentType](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_Channel.html#SageMaker-Type-Channel-ContentType) の値とその値を使用するアルゴリズムをいくつか示します。

組み込みアルゴリズムのコンテンツタイプ


| ContentType | アルゴリズム | 
| --- | --- | 
| application/x-image | オブジェクト検出アルゴリズム、セマンティックセグメンテーション | 
| application/x-recordio |  オブジェクト検出アルゴリズム  | 
| application/x-recordio-protobuf |  因数分解機、K-Means、k-NN、潜在的ディリクレ割り当て、線形学習、NTM、PCA、RCF、Sequence-to-Sequence  | 
| application/jsonlines |  BlazingText、DeepAR  | 
| image/jpeg |  オブジェクト検出アルゴリズム、セマンティックセグメンテーション  | 
| image/png |  オブジェクト検出アルゴリズム、セマンティックセグメンテーション  | 
| text/csv |  IP Insights、K-Means、k-NN、潜在的ディリクレ割り当て、線形学習、NTM、PCA、RCF、XGBoost  | 
| text/libsvm |  XGBoost  | 

各アルゴリズムで使用されているパラメータの要約については、個々のアルゴリズムのドキュメントまたはこの[表](https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-algo-docker-registry-paths.html)を参照してください。

## パイプモードを使用する
<a name="cdf-pipe-mode"></a>

パイプモードでは、トレーニングジョブが Amazon Simple Storage Service (Amazon S3) から直接データをストリーミングします。**ストリーミングにより、トレーニングジョブの開始時間が短縮され、スループットが向上します。これは、ファイルモードとは対照的です。ファイルモードでは、Amazon S3 からのデータは、インスタンスボリュームに保存されます。**ファイルモードでは、最終的なモデルアーティファクトと完全なトレーニングデータセットの両方を保存するためのディスク容量を使用します。パイプモードで Amazon S3 から直接データをストリーミングすることにより、トレーニングインスタンスの Amazon Elastic Block Store ボリュームのサイズを縮小できます。パイプモードでは、最終的なモデルアーティファクトを保存するのに十分なディスク容量が必要です。トレーニング入力モードの詳細については、[https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_AlgorithmSpecification.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_AlgorithmSpecification.html) を参照してください。

## CSV 形式を使用する
<a name="cdf-csv-format"></a>

多くの Amazon SageMaker AI アルゴリズムは、CSV 形式のデータによるトレーニングをサポートしています。CSV 形式のデータをトレーニングに使うには、入力データチャネルの仕様で [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_Channel.html#SageMaker-Type-Channel-ContentType](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_Channel.html#SageMaker-Type-Channel-ContentType) として **text/csv** を指定します。Amazon SageMaker AI では、CSV ファイルにヘッダーレコードを含めないことと、ターゲット変数を最初の列に含める必要があります。ターゲットが設定されていない教師なし学習アルゴリズムを実行するには、コンテンツタイプでラベル列の数を指定します。たとえば、この場合は **'content\$1type=text/csv;label\$1size=0'** と指定します。詳細については、「[Now use Pipe mode with CSV datasets for faster training on Amazon SageMaker AI built-in algorithms](https://aws.amazon.com/blogs/machine-learning/now-use-pipe-mode-with-csv-datasets-for-faster-training-on-amazon-sagemaker-built-in-algorithms/)」を参照してください。

## RecordIO 形式を使用する
<a name="cdf-recordio-format"></a>

protobuf recordIO 形式では、SageMaker AI はデータセット内の各観測値を 4 バイトの浮動小数点数のセットとしてのバイナリ表現に変換し、それを protobuf の値フィールドにロードします。データの準備に Python を使用している場合は、これらの既存の変換を使用することを強くお勧めします。ただし、他の言語を使用している場合、次の protobuf 定義ファイルに、データを SageMaker AI の protobuf 形式に変換するために使うスキーマが含まれています。

**注記**  
一般的に使用される numPy 配列を protobuf recordIO 形式に変換する方法を示す例については、「[An Introduction to Factorization Machines with MNIST」(MNIST による因数分解機の概要](https://sagemaker-examples.readthedocs.io/en/latest/introduction_to_amazon_algorithms/factorization_machines_mnist/factorization_machines_mnist.html)) を参照してください。**

```
syntax = "proto2";

 package aialgs.data;

 option java_package = "com.amazonaws.aialgorithms.proto";
 option java_outer_classname = "RecordProtos";

 // A sparse or dense rank-R tensor that stores data as doubles (float64).
 message Float32Tensor   {
     // Each value in the vector. If keys is empty, this is treated as a
     // dense vector.
     repeated float values = 1 [packed = true];

     // If key is not empty, the vector is treated as sparse, with
     // each key specifying the location of the value in the sparse vector.
     repeated uint64 keys = 2 [packed = true];

     // An optional shape that allows the vector to represent a matrix.
     // For example, if shape = [ 10, 20 ], floor(keys[i] / 20) gives the row,
     // and keys[i] % 20 gives the column.
     // This also supports n-dimensonal tensors.
     // Note: If the tensor is sparse, you must specify this value.
     repeated uint64 shape = 3 [packed = true];
 }

 // A sparse or dense rank-R tensor that stores data as doubles (float64).
 message Float64Tensor {
     // Each value in the vector. If keys is empty, this is treated as a
     // dense vector.
     repeated double values = 1 [packed = true];

     // If this is not empty, the vector is treated as sparse, with
     // each key specifying the location of the value in the sparse vector.
     repeated uint64 keys = 2 [packed = true];

     // An optional shape that allows the vector to represent a matrix.
     // For example, if shape = [ 10, 20 ], floor(keys[i] / 10) gives the row,
     // and keys[i] % 20 gives the column.
     // This also supports n-dimensonal tensors.
     // Note: If the tensor is sparse, you must specify this value.
     repeated uint64 shape = 3 [packed = true];
 }

 // A sparse or dense rank-R tensor that stores data as 32-bit ints (int32).
 message Int32Tensor {
     // Each value in the vector. If keys is empty, this is treated as a
     // dense vector.
     repeated int32 values = 1 [packed = true];

     // If this is not empty, the vector is treated as sparse with
     // each key specifying the location of the value in the sparse vector.
     repeated uint64 keys = 2 [packed = true];

     // An optional shape that allows the vector to represent a matrix.
     // For Exmple, if shape = [ 10, 20 ], floor(keys[i] / 10) gives the row,
     // and keys[i] % 20 gives the column.
     // This also supports n-dimensonal tensors.
     // Note: If the tensor is sparse, you must specify this value.
     repeated uint64 shape = 3 [packed = true];
 }

 // Support for storing binary data for parsing in other ways (such as JPEG/etc).
 // This is an example of another type of value and may not immediately be supported.
 message Bytes {
     repeated bytes value = 1;

     // If the content type of the data is known, stores it.
     // This allows for the possibility of using decoders for common formats
     // in the future.
     optional string content_type = 2;
 }

 message Value {
     oneof value {
         // The numbering assumes the possible use of:
         // - float16, float128
         // - int8, int16, int32
         Float32Tensor float32_tensor = 2;
         Float64Tensor float64_tensor = 3;
         Int32Tensor int32_tensor = 7;
         Bytes bytes = 9;
     }
 }

 message Record {
     // Map from the name of the feature to the value.
     //
     // For vectors and libsvm-like datasets,
     // a single feature with the name `values`
     // should be specified.
     map<string, Value> features = 1;

     // An optional set of labels for this record.
     // Similar to the features field above, the key used for
     // generic scalar / vector labels should be 'values'.
     map<string, Value> label = 2;

     // A unique identifier for this record in the dataset.
     //
     // Whilst not necessary, this allows better
     // debugging where there are data issues.
     //
     // This is not used by the algorithm directly.
     optional string uid = 3;

     // Textual metadata describing the record.
     //
     // This may include JSON-serialized information
     // about the source of the record.
     //
     // This is not used by the algorithm directly.
     optional string metadata = 4;

     // An optional serialized JSON object that allows per-record
     // hyper-parameters/configuration/other information to be set.
     //
     // The meaning/interpretation of this field is defined by
     // the algorithm author and may not be supported.
     //
     // This is used to pass additional inference configuration
     // when batch inference is used (e.g. types of scores to return).
     optional string configuration = 5;
 }
```

プロトコルバッファを作成した後、Amazon SageMaker AI がアクセス可能な Amazon S3 の場所に保存して、`create_training_job` の `InputDataConfig` の一部として渡すことができます。

**注記**  
すべての Amazon SageMaker AI アルゴリズムについて、`InputDataConfig` の `ChannelName` は `train` に設定する必要があります。一部のアルゴリズムでも検証またはテスト `input channels` がサポートされています。これらは通常、ホールドアウトデータセットを使用してモデルのパフォーマンスを評価するために使用されます。ホールドアウトデータセットは、最初のトレーニングでは使用されませんが、モデルをさらに調整するために使用できます。

## トレーニング済みモデルの逆シリアル化
<a name="td-deserialization"></a>

Amazon SageMaker AI モデルは、`create_training_job` 呼び出しの `OutputDataConfig` `S3OutputPath` パラメータで指定された S3 バケットの model.tar.gz として保存されます。S3 バケットは、ノートブックインスタンスと同じ AWS リージョンにある必要があります。ホスティングモデルを作成しているときに、これらのほとんどのモデルアーティファクトを指定することができます。ノートブックインスタンスで開いて確認することもできます。`model.tar.gz` が解凍されると、`model_algo-1` が含まれています。これは、シリアル化された Apache MXNet オブジェクトです。たとえば、次を使用して k-means モデルをメモリにロードし、表示します。

```
import mxnet as mx
print(mx.ndarray.load('model_algo-1'))
```

# 推論の共通データ形式
<a name="cdf-inference"></a>

Amazon SageMaker AI アルゴリズムは、オンラインのミニバッチ予測取得に使用される、HTTP ペイロード用の異なる MIME タイプをいくつか受け入れて生成します。複数の AWS サービスを使用して、推論を実行する前にレコードを変換または前処理できます。少なくとも、以下のデータを変換する必要があります。
+ 推論リクエストのシリアル化 (ユーザーによる処理) 
+ 推論リクエストの逆シリアル化 (アルゴリズムによる処理) 
+ 推論レスポンスのシリアル化 (アルゴリズムによる処理) 
+ 推論レスポンスの逆シリアル化 (ユーザーによる処理) 

**Topics**
+ [推論リクエストのシリアル化のためにデータを変換する](#ir-serialization)
+ [推論レスポンスの逆シリアル化のためにデータを変換する](#ir-deserialization)
+ [すべてのアルゴリズムに共通のリクエスト形式](#common-in-formats)
+ [組み込みアルゴリズムでバッチ変換を使用する](#cm-batch)

## 推論リクエストのシリアル化のためにデータを変換する
<a name="ir-serialization"></a>

Amazon SageMaker AI アルゴリズムの推論リクエストのコンテンツタイプオプションには、`text/csv`、`application/json`、`application/x-recordio-protobuf` が含まれます。これらのすべてのタイプをサポートしていないアルゴリズムは、他のタイプをサポートできます。たとえば、XGBoost はこのリストの `text/csv` のみをサポートしていますが、`text/libsvm` もサポートしています。

`text/csv` の場合、`invoke_endpoint` の Body 引数の値は、各機能の値をカンマで区切った文字列である必要があります。例えば、4 つの機能があるモデルのレコードは `1.5,16.0,14,23.0` のようになります。トレーニングデータに対して実行された変換はすべて、推論を取得する前にデータに実行される必要があります。機能の順序は重要であるため、変更せずそのままにしておく必要があります。

`application/json` は柔軟性が向上しており、開発者がアプリケーションで使用するための複数の有効な形式を提供しています。高いレベルで、JavaScript のペイロードは次のようになる場合があります。

```
let request = {
  // Instances might contain multiple rows that predictions are sought for.
  "instances": [
    {
      // Request and algorithm specific inference parameters.
      "configuration": {},
      // Data in the specific format required by the algorithm.
      "data": {
         "<field name>": dataElement
       }
    }
  ]
}
```

`dataElement` を指定するために、次のオプションがあります。

**同等のプロトコルバッファ**

```
// Has the same format as the protocol buffers implementation described for training.
let dataElement = {
  "keys": [],
  "values": [],
  "shape": []
}
```

**単純な数値ベクトル**

```
// An array containing numeric values is treated as an instance containing a
// single dense vector.
let dataElement = [1.5, 16.0, 14.0, 23.0]

// It will be converted to the following representation by the SDK.
let converted = {
  "features": {
    "values": dataElement
  }
}
```

**複数数のレコード:**

```
let request = {
  "instances": [
    // First instance.
    {
      "features": [ 1.5, 16.0, 14.0, 23.0 ]
    },
    // Second instance.
    {
      "features": [ -2.0, 100.2, 15.2, 9.2 ]
    }
  ]
}
```

## 推論レスポンスの逆シリアル化のためにデータを変換する
<a name="ir-deserialization"></a>

Amazon SageMaker AI アルゴリズムは、いくつかのレイアウトで JSON を返します。高いレベルで、構造は次のようになります。

```
let response = {
  "predictions": [{
    // Fields in the response object are defined on a per algorithm-basis.
  }]
}
```

予測に含まれるフィールドはアルゴリズムで異なります。以下は、k-means アルゴリズムの出力例です。

**単一レコード推論** 

```
let response = {
  "predictions": [{
    "closest_cluster": 5,
    "distance_to_cluster": 36.5
  }]
}
```

**複数レコード推論**

```
let response = {
  "predictions": [
    // First instance prediction.
    {
      "closest_cluster": 5,
      "distance_to_cluster": 36.5
    },
    // Second instance prediction.
    {
      "closest_cluster": 2,
      "distance_to_cluster": 90.3
    }
  ]
}
```

**protobuf 入力を使用した複数レコード推論**

```
{
  "features": [],
  "label": {
    "closest_cluster": {
      "values": [ 5.0 ] // e.g. the closest centroid/cluster was 1.0
    },
    "distance_to_cluster": {
      "values": [ 36.5 ]
    }
  },
  "uid": "abc123",
  "metadata": "{ "created_at": '2017-06-03' }"
}
```

SageMaker AI アルゴリズムは JSONLINES 形式もサポートします。この形式では、レコードごとのレスポンスコンテンツが JSON 形式と同じです。複数レコード構造は、レコードごとのレスポンスオブジェクトが改行文字で区切られて集まったものです。2 つの入力データポイントに対する組み込み kmeans アルゴリズムのレスポンスコンテンツは、次のとおりです。

```
{"distance_to_cluster": 23.40593910217285, "closest_cluster": 0.0}
{"distance_to_cluster": 27.250282287597656, "closest_cluster": 0.0}
```

バッチ変換の実行中は、`CreateTransformJobRequest` の `Accept` フィールドを `application/jsonlines` に設定して `jsonlines` レスポンスタイプを使用することをお勧めします。

## すべてのアルゴリズムに共通のリクエスト形式
<a name="common-in-formats"></a>

ほとんどのアルゴリズムでは、次の推論リクエスト形式の多くが使用されます。

### JSON リクエストの形式
<a name="cm-json"></a>

**コンテンツタイプ:** application/JSON

**高密度形式**

```
let request =   {
    "instances":    [
        {
            "features": [1.5, 16.0, 14.0, 23.0]
        }
    ]
}


let request =   {
    "instances":    [
        {
            "data": {
                "features": {
                    "values": [ 1.5, 16.0, 14.0, 23.0]
                }
            }
        }
    ]
}
```

**疎形式**

```
{
	"instances": [
		{"data": {"features": {
					"keys": [26, 182, 232, 243, 431],
					"shape": [2000],
					"values": [1, 1, 1, 4, 1]
				}
			}
		},
		{"data": {"features": {
					"keys": [0, 182, 232, 243, 431],
					"shape": [2000],
					"values": [13, 1, 1, 4, 1]
				}
			}
		},
	]
}
```

### JSONLINES リクエストの形式
<a name="cm-jsonlines"></a>

**コンテンツタイプ:** application/JSONLINES

**高密度形式**

高密度形式の単一レコードは、次のいずれかで表すことができます。

```
{ "features": [1.5, 16.0, 14.0, 23.0] }
```

または

```
{ "data": { "features": { "values": [ 1.5, 16.0, 14.0, 23.0] } }
```

**疎形式**

疎形式の単一レコードは、次のように表されます。

```
{"data": {"features": { "keys": [26, 182, 232, 243, 431], "shape": [2000], "values": [1, 1, 1, 4, 1] } } }
```

複数のレコードは、単一レコード表現が改行文字で区切られて集まったものとして表されます。

```
{"data": {"features": { "keys": [0, 1, 3], "shape": [4], "values": [1, 4, 1] } } }
{ "data": { "features": { "values": [ 1.5, 16.0, 14.0, 23.0] } }
{ "features": [1.5, 16.0, 14.0, 23.0] }
```

### CSV リクエストの形式
<a name="cm-csv"></a>

**コンテンツタイプ:** text/CSV; label\$1size=0

**注記**  
CSV のサポートは因数分解機では利用できません。

### RECORDIO リクエストの形式
<a name="cm-recordio"></a>

コンテンツタイプ: application/x-recordio-protobuf

## 組み込みアルゴリズムでバッチ変換を使用する
<a name="cm-batch"></a>

バッチ変換の実行中は、JSON の代わりに JSONLINES レスポンスタイプを使用することをお勧めします (ただし、アルゴリズムでサポートされている場合)。これを行うには、`CreateTransformJobRequest` の `Accept` フィールドを `application/jsonlines` に設定します。

変換ジョブを作成するときには、入力データの `ContentType` に基づいて `SplitType` を設定する必要があります。同様に、`CreateTransformJobRequest` の `Accept` フィールドに応じて `AssembleWith` を設定する必要があります。次の表を使用して、これらのフィールドを設定します。


| ContentType | 推奨される SplitType | 
| --- | --- | 
| application/x-recordio-protobuf | RecordIO | 
| text/csv | Line | 
| application/jsonlines | Line | 
| application/json | None | 
| application/x-image | None | 
| image/\$1 | None | 


| Accept | 推奨される AssembleWith | 
| --- | --- | 
| application/x-recordio-protobuf | None | 
| application/json | None | 
| application/jsonlines | Line | 

特定のアルゴリズムのレスポンス形式の詳細については、以下を参照してください。
+ [DeepAR 推論の形式](deepar-in-formats.md)
+ [因数分解機のレスポンス形式](fm-in-formats.md)
+ [IP Insights 推論データの形式](ip-insights-inference-data-formats.md)
+ [k-means のレスポンス形式](km-in-formats.md)
+ [k-NN リクエストとレスポンスの形式](kNN-inference-formats.md)
+ [線形学習のレスポンス形式](LL-in-formats.md)
+ [NTM のレスポンス形式](ntm-in-formats.md)
+ [Object2Vec 推論のデータ形式](object2vec-inference-formats.md)
+ [Object2Vec のエンコーダー埋め込み](object2vec-encoder-embeddings.md)
+ [PCA のレスポンス形式](PCA-in-formats.md)
+ [RCF のレスポンス形式](rcf-in-formats.md)

# 組み込みアルゴリズムのインスタンスタイプ
<a name="cmn-info-instance-types"></a>

ほとんどの Amazon SageMaker AI アルゴリズムは、トレーニングに GPU コンピューティングを活用するように設計されています。インスタンスごとのコストは高いものの、GPU はトレーニングをより迅速に行うため、費用対効果が高くなります。このガイドには例外が記載されています。

サポートされている EC2 インスタンスの詳細については、「[Instance details](https://aws.amazon.com/sagemaker-ai/pricing/#Instance_details)」を参照してください。

データのサイズとタイプは、どのハードウェア構成が最も効果を発揮するかどうかに大きな影響を与えます。同じモデルが定期的にトレーニングされる場合、インスタンスタイプの初期テストで、長期的に見てよりコスト効率の良い構成を発見できます。さらに、GPU に対して最も効率的にトレーニングするアルゴリズムは、効率的な推論に GPU を必要としない場合があります。最も費用対効果の高いソリューションを試してみてください。自動インスタンスレコメンデーションを取得したり、カスタムロードテストを実施したりするには、[Amazon SageMaker Inference Recommender](https://docs.aws.amazon.com/sagemaker/latest/dg/inference-recommender.html) を使用してください。

SageMaker AI ハードウェア仕様の詳細については、[Amazon SageMakerの料金](https://aws.amazon.com/sagemaker/ai/pricing/)」を参照してください。

**UltraServers**

UltraServers は、低レイテンシー、高帯域幅のアクセラレーター相互接続を使用して複数の Amazon EC2 インスタンスを接続します。これらは、大量の処理能力を必要とする大規模な AI/ML ワークロードを処理するように構築されています。詳細については、「[Amazon EC2 UltraServers](https://aws.amazon.com/ec2/ultraservers/)」を参照してください。UltraServer の使用を開始するには、「[トレーニングジョブまたは HyperPod クラスターのトレーニングプランを予約する](https://docs.aws.amazon.com/sagemaker/latest/dg/reserve-capacity-with-training-plans.html)」を参照してください。

Amazon SageMaker AI で UltraServer の使用を開始するには、[トレーニングプランを作成](https://docs.aws.amazon.com/sagemaker/latest/dg/reserve-capacity-with-training-plans.html)します。UltraServer がトレーニングプランで使用できるようになったら、 AWS マネジメントコンソール、Amazon SageMaker AI API、または を使用してトレーニングジョブを作成します AWS CLI。トレーニングプランで購入した UltraServer インスタンスタイプを必ず指定してください。

UltraServer では一度に 1 つ以上のジョブを実行できます。UltraServer ではインスタンスがグループ化されるため、UltraServer キャパシティを組織で割り当てる方法について柔軟性があります。ジョブを設定するときは、組織のデータセキュリティガイドラインも忘れないようにしてください。1 つの UltraServer のインスタンスが同じ UltraServer の別のインスタンスの別のジョブのデータにアクセスできるためです。

UltraServer でハードウェア障害が発生した場合、SageMaker AI では自動的に問題を解決しようとします。SageMaker AI が問題を調査して解決すると、 AWS Health イベントまたは を通じて通知とアクションを受け取ることがあります AWS サポート。

トレーニングジョブが完了すると、SageMaker AI はインスタンスを停止しますが、プランがまだアクティブな場合はトレーニングプランで引き続き使用できます。ジョブの完了後に UltraServer のインスタンスを実行し続けるには、[マネージドウォームプール](https://docs.aws.amazon.com/sagemaker/latest/dg/train-warm-pools.html)を使用できます。

トレーニングプランに十分なキャパシティがある場合は、複数の UltraServer でトレーニングジョブを実行することもできます。デフォルトでは、各 UltraServer には 17 個のインスタンスと 1 個の予備のインスタンスで構成される 18 個のインスタンスが付属しています。さらにインスタンスが必要な場合は、UltraServer を追加購入する必要があります。トレーニングジョブを作成するときは、`InstancePlacementConfig` パラメータを使用して UltraServer 間でジョブを配置する方法を設定できます。

ジョブ配置を設定しない場合、SageMaker AI は UltraServer 内のインスタンスにジョブを自動的に割り当てます。このデフォルトの戦略は、別の UltraServer を使用する前に、1 つの UltraServer ですべてのインスタンスを満たすことを優先するベストエフォートに基づいています。例えば、14 個のインスタンスをリクエストし、トレーニングプランに 2 個の UltraServer がある場合、SageMaker AI では最初の UltraServer のすべてのインスタンスを使用します。20 個のインスタンスをリクエストし、トレーニングプランに 2 個の UltraServer がある場合、SageMaker AI は最初の UltraServer の 17 個のインスタンスすべてを使用してから、2 番目の UltraServer の 3 個のインスタンスを使用します。UltraServer 内のインスタンスでは NVLink を使用して通信しますが、個々の UltraServer では Elastic Fabric Adapter (EFA) を使用し、これがモデルトレーニングのパフォーマンスに影響する可能性があります。

# 組み込みアルゴリズムのログ
<a name="common-info-all-sagemaker-models-logs"></a>

Amazon SageMaker AI アルゴリズムは Amazon CloudWatch Logs を生成して、トレーニングプロセスに関する詳細情報を提供します。ログを表示するには、 AWS マネジメントコンソールで **CloudWatch** を選択し、**Logs** を選択し、/aws/sagemaker/TrainingJobs **ロググループ**を選択します。各トレーニングジョブには、トレーニングされたノードごとに 1 つのログストリームがあります。ログストリームの名前は、ジョブの作成時に `TrainingJobName` パラメータで指定された値で始まります。

**注記**  
ジョブが失敗してログが CloudWatch に表示されない場合、トレーニングの開始前にエラーが発生した可能性があります。理由は、間違ったトレーニングイメージや S3 の場所の指定が含まれます。

ログの内容は、アルゴリズムによって異なります。ただし、一般的には次の情報が表示されます。
+ ログの先頭で指定された引数の確認
+ トレーニング中に発生したエラー
+ アルゴリズム精度や数値パフォーマンスの測定
+ アルゴリズムのタイミングとアルゴリズム内の主要なステージ

## 共通エラー
<a name="example-errors"></a>

トレーニングジョブが失敗した場合、一部のエラーの詳細はトレーニングジョブ説明の `FailureReason` 戻り値によって以下のように提供されます。

```
sage = boto3.client('sagemaker')
sage.describe_training_job(TrainingJobName=job_name)['FailureReason']
```

それ以外は、CloudWatch Logs でのみ報告されます。一般的なエラーは以下のとおりです。

1. ハイパーパラメータを指定しない、またはアルゴリズムに対して無効なハイパーパラメータの指定。

   **CloudWatch Log から**

   ```
   [10/16/2017 23:45:17 ERROR 139623806805824 train.py:48]
   Additional properties are not allowed (u'mini_batch_siz' was
   unexpected)
   ```

1. ハイパーパラメータへの無効な値の指定。

   **FailureReason**

   ```
   AlgorithmError: u'abc' is not valid under any of the given
   schemas\n\nFailed validating u'oneOf' in
   schema[u'properties'][u'feature_dim']:\n    {u'oneOf':
   [{u'pattern': u'^([1-9][0-9]*)$', u'type': u'string'},\n
   {u'minimum': 1, u'type': u'integer'}]}\
   ```

   **FailureReason**

   ```
   [10/16/2017 23:57:17 ERROR 140373086025536 train.py:48] u'abc'
   is not valid under any of the given schemas
   ```

1. 不正確な protobuf ファイル形式。

   **CloudWatch Log から**

   ```
   [10/17/2017 18:01:04 ERROR 140234860816192 train.py:48] cannot
                      copy sequence with size 785 to array axis with dimension 784
   ```