diff --git a/.github/workflows/docker_image_ci.yml b/.github/workflows/docker_image_ci.yml index 0753683..9d393b6 100644 --- a/.github/workflows/docker_image_ci.yml +++ b/.github/workflows/docker_image_ci.yml @@ -3,8 +3,9 @@ name: Docker image CI on: push: paths: - - setup_files/Dockerfile - - setup_files/requirements.txt + - app/Dockerfile + - app/requirements.txt + - .github/workflows/docker_image_ci.yml jobs: build: @@ -13,5 +14,5 @@ jobs: - uses: actions/checkout@v4 - name: Build the Docker image run: | - cd setup_files + cd app docker build . -f Dockerfile diff --git a/Makefile b/Makefile index f7631e8..38a5d95 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ app: - cd ./setup_files && modal deploy __main__.py + cd ./app && modal deploy __main__.py # `--upscaler` is a name of upscaler you want to use. # You can use upscalers the below: @@ -8,7 +8,7 @@ app: # - `RealESRGAN_x4plus_anime_6B` # - `RealESRGAN_x2plus` 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" \ --n-prompt "" \ --height 512 \ @@ -21,7 +21,7 @@ img_by_sd15_txt2img: --output-format "avif" 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" \ --n-prompt "" \ --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" 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" \ --height 1024 \ --width 1024 \ diff --git a/README.md b/README.md index e33f1c0..0a54640 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Please see [the documentation of Modal](https://modal.com/docs/guide) for modals To use the script, execute the below. 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. 4. Execute `make app` command. An application will be deployed to Modal. 5. Execute `make img_by_sd15_txt2img` command. @@ -56,13 +56,13 @@ Images are generated and output to the `outputs/` directory. ├── .env # Secrets manager ├── Makefile ├── README.md -├── sdcli/ # A directory with scripts to run inference. +├── cmd/ # A directory with scripts to run inference. │   ├── outputs/ # Images are outputted this directory. │   ├── sd15_img2img.py # A script to run sd15_img2img inference. │   ├── sd15_txt2img.py # A script to run sd15_txt2img inference. │   ├── sdxl_txt2img.py # A script to run sdxl_txt2img inference. │   └── util.py -└── setup_files/ # A directory with config files. +└── app/ # A directory with config files. ├── __main__.py # A main script to run inference. ├── Dockerfile # To build a base image. ├── 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." ``` -### 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. @@ -124,7 +124,7 @@ Set the prompt to Makefile. ```makefile # ex) run: - cd ./sdcli && modal run txt2img.py \ + cd ./cmd && modal run txt2img.py \ --prompt "hogehoge" \ --n-prompt "mogumogu" \ --height 768 \ diff --git a/README_ja.md b/README_ja.md index 125bc18..cb38415 100644 --- a/README_ja.md +++ b/README_ja.md @@ -44,7 +44,7 @@ modal token new 下記の手順で画像が生成され、outputs ディレクトリに出力されます。 1. リポジトリをgit clone -2. ./setup_files/config.example.yml を ./setup_files/config.ymlにコピー +2. ./app/config.example.yml を ./app/config.ymlにコピー 3. Makefile を開いてプロンプトを設定 4. make appをコマンドラインで実行(Modal上にアプリケーションが構築されます) 5. make img_by_sd15_txt2img(スクリプトが起動します) @@ -56,13 +56,13 @@ modal token new ├── .env # Secrets manager ├── Makefile ├── README.md -├── sdcli/ # A directory with scripts to run inference. +├── cmd/ # A directory with scripts to run inference. │   ├── outputs/ # Images are outputted this directory. │   ├── sd15_img2img.py # A script to run sd15_img2img inference. │   ├── sd15_txt2img.py # A script to run sd15_txt2img inference. │   ├── sdxl_txt2img.py # A script to run sdxl_txt2img inference. │   └── util.py -└── setup_files/ # A directory with config files. +└── app/ # A directory with config files. ├── __main__.py # A main script to run inference. ├── Dockerfile # To build a base image. ├── config.yml # To set a model, vae and some tools. @@ -91,7 +91,7 @@ Hugging FaceのトークンをHUGGING_FACE_TOKENに記入します。 HUGGING_FACE_TOKEN="ここにHuggingFaceのトークンを記載する" ``` -### 3. ./setup_files/config.ymlを設定する +### 3. ./app/config.ymlを設定する 推論に使うモデルを設定します。Safetensorsファイルをそのまま利用します。VAE、LoRA、Textual Inversionも設定可能です。 @@ -126,7 +126,7 @@ loras: ```makefile # 設定例 run: - cd ./sdcli && modal run txt2img.py \ + cd ./cmd && modal run txt2img.py \ --prompt "hogehoge" \ --n-prompt "mogumogu" \ --height 768 \ diff --git a/setup_files/Dockerfile b/app/Dockerfile similarity index 100% rename from setup_files/Dockerfile rename to app/Dockerfile diff --git a/setup_files/__main__.py b/app/__main__.py similarity index 100% rename from setup_files/__main__.py rename to app/__main__.py diff --git a/setup_files/config.sample.yml b/app/config.sample.yml similarity index 93% rename from setup_files/config.sample.yml rename to app/config.sample.yml index 52ec0d8..ae6da56 100644 --- a/setup_files/config.sample.yml +++ b/app/config.sample.yml @@ -1,7 +1,7 @@ ########## # This is the config file to set a base model, vae and some tools. # Rename the file to `config.yml` before running the script. -# Execute `modal deploy ./setup_files/setup.py` every time modify this file. +# Execute `modal deploy ./app/setup.py` every time modify this file. ########## ########## diff --git a/setup_files/requirements.txt b/app/requirements.txt similarity index 100% rename from setup_files/requirements.txt rename to app/requirements.txt diff --git a/setup_files/setup.py b/app/setup.py similarity index 100% rename from setup_files/setup.py rename to app/setup.py diff --git a/setup_files/stable_diffusion_1_5.py b/app/stable_diffusion_1_5.py similarity index 100% rename from setup_files/stable_diffusion_1_5.py rename to app/stable_diffusion_1_5.py diff --git a/setup_files/stable_diffusion_xl.py b/app/stable_diffusion_xl.py similarity index 100% rename from setup_files/stable_diffusion_xl.py rename to app/stable_diffusion_xl.py diff --git a/sdcli/sd15_img2img.py b/cmd/sd15_img2img.py similarity index 100% rename from sdcli/sd15_img2img.py rename to cmd/sd15_img2img.py diff --git a/sdcli/sd15_txt2img.py b/cmd/sd15_txt2img.py similarity index 100% rename from sdcli/sd15_txt2img.py rename to cmd/sd15_txt2img.py diff --git a/sdcli/sdxl_txt2img.py b/cmd/sdxl_txt2img.py similarity index 100% rename from sdcli/sdxl_txt2img.py rename to cmd/sdxl_txt2img.py diff --git a/sdcli/util.py b/cmd/util.py similarity index 100% rename from sdcli/util.py rename to cmd/util.py