

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

# Stability.ai Stable Diffusion 3.5 Large
<a name="model-parameters-diffusion-3-5-large"></a>

Stable Diffusion 3.5 Large モデルは 80 億個のパラメータを使用し、テキストから画像生成と画像から画像生成の出力 (解像度 1 メガピクセル) をサポートします。

リクエスト本文は、[InvokeModel](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModel.html) へのリクエストの `body` フィールドに入れて渡されます。

**モデル呼び出しリクエストの body フィールド**

Stable Diffusion 3.5 Large モデルを使用して InvokeModel 呼び出しを行うときは、本文フィールドに次のような JSON オブジェクトを入力します。
+ **prompt** – (文字列) 目的の出力画像のテキスト説明。最大 10,000 文字    
[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/bedrock/latest/userguide/model-parameters-diffusion-3-5-large.html)

**モデル呼び出しレスポンスの body フィールド**

Stable Diffusion 3.5 Large モデルを使用して`InvokeModel`呼び出しを行うと、レスポンスは次のようになります。

```
{
    'seeds': [2130420379], 
    "finish_reasons":[null], 
    "images":["..."]
}
```

終了理由が ではないレスポンス`null`は次のようになります。

```
{
    "finish_reasons":["Filter reason: prompt"]
}
```
+ **seeds** – (文字列) モデルの画像生成に使用されるシードのリストです。
+ **finish\_reasons** – リクエストがフィルタリングされたかどうかを示す列挙型です。`null` はリクエストが成功したことを示します。現在の可能な値: `"Filter reason: prompt", "Filter reason: output image", "Filter reason: input image", "Inference error", null`。
+ **images** – base64 文字列形式で生成された画像のリストです。

------
#### [ Text to image ]

Stability.ai Stable Diffusion 3.5 Large モデルには、テキストから画像を生成する推論呼び出し向けに以下の推論パラメータが用意されています。
+ **prompt** (文字列) – 目的の出力イメージのテキスト説明。最大 10,000 文字    
[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/bedrock/latest/userguide/model-parameters-diffusion-3-5-large.html)

**任意指定のパラメータ**
+ **aspect\_ratio** (文字列) – 生成された画像のアスペクト比を制御します。テキストから画像へのリクエストにのみ有効です。列挙型: 16:9、1:1、21:9、2:3、3:2、4:5、5:4、9:16、9:21。デフォルトは 1:1 です。
+ **mode** (文字列) (GenerationMode) - デフォルト: text-to-image。列挙型: image-to-image または text-to-image。これがテキストから画像生成なのか画像から画像生成なのかを制御します。これは、必要なパラメータに影響します。
  + text-to-image の場合、プロンプトパラメータのみ必要です。
  + 画像から画像の場合、プロンプト、画像、および強度パラメータが必要です。
+ **seed** (数値) – 生成時のランダム性を制御する値。範囲は 0～4294967294 です。デフォルトは 0 (ランダムシード) です。    
[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/bedrock/latest/userguide/model-parameters-diffusion-3-5-large.html)
+ **negative\_prompt** (文字列) – 出力イメージから除外する要素を説明するテキスト。最大 10,000 文字    
[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/bedrock/latest/userguide/model-parameters-diffusion-3-5-large.html)
+ **output\_format** (文字列) – 出力イメージ形式。列挙型: jpeg、png、webp。デフォルトは png です。

```
import boto3
import json

bedrock = boto3.client('bedrock-runtime', region_name='us-west-2')
response = bedrock.invoke_model(
    modelId='stability.sd3-5-large-v1:0',
    body=json.dumps({
        'prompt': 'A car made out of vegetables.'
    })
)
```

------
#### [ Image to image ]

Stability.ai Stable Diffusion 3.5 Large モデルには、画像から画像を生成する推論呼び出し向けに以下の推論パラメータが用意されています。
+ **prompt** (文字列) – 目的の出力イメージのテキスト説明。最大 10,000 文字    
[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/bedrock/latest/userguide/model-parameters-diffusion-3-5-large.html)
+ **image** (文字列) – Base64-encodedされた入力イメージ。1 辺あたり 64 ピクセル以上。サポートされている形式: jpeg、png、webp。
+ **mode** (文字列) (GenerationMode) - デフォルト: text-to-image。列挙型: image-to-image または text-to-image。これがテキストから画像生成なのか画像から画像生成なのかを制御します。これは、必要なパラメータに影響します。
  + text-to-image の場合、プロンプトパラメータのみ必要です。
  + 画像から画像の場合、プロンプト、画像、および強度パラメータが必要です。
+ **strength** (数値) – 入力イメージの出力への影響を制御します。範囲は 0～1 です。値 0 は入力画像を保持し、値 1 は入力画像を無視します。    
[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/bedrock/latest/userguide/model-parameters-diffusion-3-5-large.html)
+ **seed** (数値) – 生成時のランダム性を制御する値。範囲は 0～4294967294 です。デフォルトは 0 (ランダムシード) です。    
[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/bedrock/latest/userguide/model-parameters-diffusion-3-5-large.html)
+ **negative\_prompt** (文字列) – 出力イメージから除外する要素を説明するテキスト。最大 10,000 文字    
[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/bedrock/latest/userguide/model-parameters-diffusion-3-5-large.html)
+ **output\_format** (文字列) – 出力イメージ形式。列挙型: jpeg、png、webp。デフォルトは png です。

```
import boto3
import base64
import json

# Load and encode image
with open('input_image.jpg', 'rb') as image_file:
    image_base64 = base64.b64encode(image_file.read()).decode('utf-8')

bedrock = boto3.client('bedrock-runtime', region_name='us-west-2')
response = bedrock.invoke_model(
    modelId='stability.sd3-5-large-v1:0',
    body=json.dumps({
        'prompt': 'A car made out of vegetables.',
        'image': image_base64,
        'strength': 0.7
    })
)
```

------