Modify README and Makefile.

This commit is contained in:
hodanov 2023-12-29 13:12:36 +09:00
parent 5269f74630
commit 16cda3a7e2
3 changed files with 14 additions and 14 deletions

View File

@ -1,5 +1,5 @@
app: app:
cd ./setup_files && modal deploy __main__.py cd ./app && modal deploy __main__.py
# `--upscaler` is a name of upscaler you want to use. # `--upscaler` is a name of upscaler you want to use.
# You can use upscalers the below: # You can use upscalers the below:
@ -8,7 +8,7 @@ app:
# - `RealESRGAN_x4plus_anime_6B` # - `RealESRGAN_x4plus_anime_6B`
# - `RealESRGAN_x2plus` # - `RealESRGAN_x2plus`
img_by_sd15_txt2img: img_by_sd15_txt2img:
cd ./sdcli && modal run sd15_txt2img.py \ cd ./cmd && modal run sd15_txt2img.py \
--prompt "a photograph of an astronaut riding a horse" \ --prompt "a photograph of an astronaut riding a horse" \
--n-prompt "" \ --n-prompt "" \
--height 512 \ --height 512 \
@ -21,7 +21,7 @@ img_by_sd15_txt2img:
--output-format "avif" --output-format "avif"
img_by_sd15_img2img: img_by_sd15_img2img:
cd ./sdcli && modal run sd15_img2img.py \ cd ./cmd && modal run sd15_img2img.py \
--prompt "cat wizard, gandalf, lord of the rings, detailed, fantasy, cute, adorable, Pixar, Disney, 8k" \ --prompt "cat wizard, gandalf, lord of the rings, detailed, fantasy, cute, adorable, Pixar, Disney, 8k" \
--n-prompt "" \ --n-prompt "" \
--samples 1 \ --samples 1 \
@ -33,7 +33,7 @@ img_by_sd15_img2img:
--base-image-url "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png" --base-image-url "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png"
img_by_sdxl_txt2img: img_by_sdxl_txt2img:
cd ./sdcli && modal run sdxl_txt2img.py \ cd ./cmd && modal run sdxl_txt2img.py \
--prompt "A dog is running on the grass" \ --prompt "A dog is running on the grass" \
--height 1024 \ --height 1024 \
--width 1024 \ --width 1024 \

View File

@ -42,7 +42,7 @@ Please see [the documentation of Modal](https://modal.com/docs/guide) for modals
To use the script, execute the below. To use the script, execute the below.
1. git clone the repository. 1. git clone the repository.
2. Copy `./setup_files/config.sample.yml` to `./setup_files/config.yml` 2. Copy `./app/config.sample.yml` to `./app/config.yml`
3. Open the Makefile and set prompts. 3. Open the Makefile and set prompts.
4. Execute `make app` command. An application will be deployed to Modal. 4. Execute `make app` command. An application will be deployed to Modal.
5. Execute `make img_by_sd15_txt2img` command. 5. Execute `make img_by_sd15_txt2img` command.
@ -56,13 +56,13 @@ Images are generated and output to the `outputs/` directory.
├── .env # Secrets manager ├── .env # Secrets manager
├── Makefile ├── Makefile
├── README.md ├── README.md
├── sdcli/ # A directory with scripts to run inference. ├── cmd/ # A directory with scripts to run inference.
│   ├── outputs/ # Images are outputted this directory. │   ├── outputs/ # Images are outputted this directory.
│   ├── sd15_img2img.py # A script to run sd15_img2img inference. │   ├── sd15_img2img.py # A script to run sd15_img2img inference.
│   ├── sd15_txt2img.py # A script to run sd15_txt2img inference. │   ├── sd15_txt2img.py # A script to run sd15_txt2img inference.
│   ├── sdxl_txt2img.py # A script to run sdxl_txt2img inference. │   ├── sdxl_txt2img.py # A script to run sdxl_txt2img inference.
│   └── util.py │   └── util.py
└── setup_files/ # A directory with config files. └── app/ # A directory with config files.
├── __main__.py # A main script to run inference. ├── __main__.py # A main script to run inference.
├── Dockerfile # To build a base image. ├── Dockerfile # To build a base image.
├── config.yml # To set a model, vae and some tools. ├── config.yml # To set a model, vae and some tools.
@ -91,7 +91,7 @@ This script downloads and uses a model from HuggingFace, but if you want to use
HUGGING_FACE_TOKEN="Write your hugging face token here." HUGGING_FACE_TOKEN="Write your hugging face token here."
``` ```
### 3. Add the model to ./setup_files/config.yml ### 3. Add the model to ./app/config.yml
Add the model used for inference. Use the Safetensors file as is. VAE, LoRA, and Textual Inversion are also configurable. Add the model used for inference. Use the Safetensors file as is. VAE, LoRA, and Textual Inversion are also configurable.
@ -124,7 +124,7 @@ Set the prompt to Makefile.
```makefile ```makefile
# ex) # ex)
run: run:
cd ./sdcli && modal run txt2img.py \ cd ./cmd && modal run txt2img.py \
--prompt "hogehoge" \ --prompt "hogehoge" \
--n-prompt "mogumogu" \ --n-prompt "mogumogu" \
--height 768 \ --height 768 \

View File

@ -44,7 +44,7 @@ modal token new
下記の手順で画像が生成され、outputs ディレクトリに出力されます。 下記の手順で画像が生成され、outputs ディレクトリに出力されます。
1. リポジトリをgit clone 1. リポジトリをgit clone
2. ./setup_files/config.example.yml を ./setup_files/config.ymlにコピー 2. ./app/config.example.yml を ./app/config.ymlにコピー
3. Makefile を開いてプロンプトを設定 3. Makefile を開いてプロンプトを設定
4. make appをコマンドラインで実行(Modal上にアプリケーションが構築されます) 4. make appをコマンドラインで実行(Modal上にアプリケーションが構築されます)
5. make img_by_sd15_txt2img(スクリプトが起動します) 5. make img_by_sd15_txt2img(スクリプトが起動します)
@ -56,13 +56,13 @@ modal token new
├── .env # Secrets manager ├── .env # Secrets manager
├── Makefile ├── Makefile
├── README.md ├── README.md
├── sdcli/ # A directory with scripts to run inference. ├── cmd/ # A directory with scripts to run inference.
│   ├── outputs/ # Images are outputted this directory. │   ├── outputs/ # Images are outputted this directory.
│   ├── sd15_img2img.py # A script to run sd15_img2img inference. │   ├── sd15_img2img.py # A script to run sd15_img2img inference.
│   ├── sd15_txt2img.py # A script to run sd15_txt2img inference. │   ├── sd15_txt2img.py # A script to run sd15_txt2img inference.
│   ├── sdxl_txt2img.py # A script to run sdxl_txt2img inference. │   ├── sdxl_txt2img.py # A script to run sdxl_txt2img inference.
│   └── util.py │   └── util.py
└── setup_files/ # A directory with config files. └── app/ # A directory with config files.
├── __main__.py # A main script to run inference. ├── __main__.py # A main script to run inference.
├── Dockerfile # To build a base image. ├── Dockerfile # To build a base image.
├── config.yml # To set a model, vae and some tools. ├── config.yml # To set a model, vae and some tools.
@ -91,7 +91,7 @@ Hugging FaceのトークンをHUGGING_FACE_TOKENに記入します。
HUGGING_FACE_TOKEN="ここにHuggingFaceのトークンを記載する" HUGGING_FACE_TOKEN="ここにHuggingFaceのトークンを記載する"
``` ```
### 3. ./setup_files/config.ymlを設定する ### 3. ./app/config.ymlを設定する
推論に使うモデルを設定します。Safetensorsファイルをそのまま利用します。VAE、LoRA、Textual Inversionも設定可能です。 推論に使うモデルを設定します。Safetensorsファイルをそのまま利用します。VAE、LoRA、Textual Inversionも設定可能です。
@ -126,7 +126,7 @@ loras:
```makefile ```makefile
# 設定例 # 設定例
run: run:
cd ./sdcli && modal run txt2img.py \ cd ./cmd && modal run txt2img.py \
--prompt "hogehoge" \ --prompt "hogehoge" \
--n-prompt "mogumogu" \ --n-prompt "mogumogu" \
--height 768 \ --height 768 \