-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from konieshadow/cog
Add cog config for replicate.com
- Loading branch information
Showing
11 changed files
with
317 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,4 @@ notification.mp3 | |
/node_modules | ||
/package-lock.json | ||
/.coverage* | ||
.cog/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Configuration for Cog ⚙️ | ||
# Reference: https://github.com/replicate/cog/blob/main/docs/yaml.md | ||
|
||
build: | ||
# set to true if your model requires a GPU | ||
gpu: true | ||
cuda: "11.8" | ||
|
||
# a list of ubuntu apt packages to install | ||
system_packages: | ||
- "libgl1-mesa-glx" | ||
- "libglib2.0-0" | ||
|
||
# python version in the form '3.11' or '3.11.4' | ||
python_version: "3.11" | ||
|
||
# a list of packages in the format <package-name>==<version> | ||
python_packages: | ||
- "torchsde==0.2.5" | ||
- "einops==0.4.1" | ||
- "transformers==4.30.2" | ||
- "safetensors==0.3.1" | ||
- "accelerate==0.21.0" | ||
- "pyyaml==6.0" | ||
- "Pillow==9.2.0" | ||
- "scipy==1.9.3" | ||
- "tqdm==4.64.1" | ||
- "psutil==5.9.5" | ||
- "numpy==1.23.5" | ||
- "pytorch_lightning==1.9.4" | ||
- "omegaconf==2.2.3" | ||
- "pygit2==1.12.2" | ||
- "opencv-contrib-python==4.8.0.74" | ||
- "torch==2.0.1" | ||
- "torchvision==0.15.2" | ||
- "xformers==0.0.21" | ||
|
||
# commands run after the environment is setup | ||
# run: | ||
# - "echo env is ready!" | ||
# - "echo another command if needed" | ||
|
||
image: "r8.im/konieshadow/fooocus-api" | ||
|
||
# predict.py defines how predictions are run on your model | ||
predict: "predict.py:Predictor" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version = '0.1.10' | ||
version = '0.1.11' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from enum import Enum | ||
from typing import BinaryIO, Dict, List, Tuple | ||
import numpy as np | ||
|
||
|
||
class GenerationFinishReason(str, Enum): | ||
success = 'SUCCESS' | ||
queue_is_full = 'QUEUE_IS_FULL' | ||
user_cancel = 'USER_CANCEL' | ||
error = 'ERROR' | ||
|
||
|
||
class ImageGenerationResult(object): | ||
def __init__(self, im: np.ndarray | None, seed: int, finish_reason: GenerationFinishReason): | ||
self.im = im | ||
self.seed = seed | ||
self.finish_reason = finish_reason | ||
|
||
|
||
class ImageGenerationParams(object): | ||
def __init__(self, prompt: str, | ||
negative_promit: str, | ||
style_selections: List[str], | ||
performance_selection: List[str], | ||
aspect_ratios_selection: str, | ||
image_number: int, | ||
image_seed: int | None, | ||
sharpness: float, | ||
guidance_scale: float, | ||
base_model_name: str, | ||
refiner_model_name: str, | ||
loras: List[Tuple[str, float]], | ||
uov_input_image: BinaryIO | None, | ||
uov_method: str, | ||
outpaint_selections: List[str], | ||
inpaint_input_image: Dict[str, np.ndarray] | None, | ||
image_prompts: List[Tuple[BinaryIO, float, float, str]]): | ||
self.prompt = prompt | ||
self.negative_promit = negative_promit | ||
self.style_selections = style_selections | ||
self.performance_selection = performance_selection | ||
self.aspect_ratios_selection = aspect_ratios_selection | ||
self.image_number = image_number | ||
self.image_seed = image_seed | ||
self.sharpness = sharpness | ||
self.guidance_scale = guidance_scale | ||
self.base_model_name = base_model_name | ||
self.refiner_model_name = refiner_model_name | ||
self.loras = loras | ||
self.uov_input_image = uov_input_image | ||
self.uov_method = uov_method | ||
self.outpaint_selections = outpaint_selections | ||
self.inpaint_input_image = inpaint_input_image | ||
self.image_prompts = image_prompts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.