Fix minor errors, update lockfile, add cli entrypoints in pyproject.toml fix README

txt2txt
Guillermo Rodriguez 2025-01-09 17:04:35 -03:00
parent 18ca8c573a
commit 1e40c05da6
No known key found for this signature in database
GPG Key ID: 002CC5F1E6BDA53E
6 changed files with 2259 additions and 1915 deletions

View File

@ -29,9 +29,6 @@ poetry shell
# test you can run this command
skynet --help
# launch ipfs node
skynet run ipfs
# to launch worker
skynet run dgpu
@ -77,9 +74,6 @@ docker pull guilledk/skynet:runtime-cuda
# or build it (takes a bit of time)
./build_docker.sh
# launch simple ipfs node
./launch_ipfs.sh
# run worker with all gpus
docker run \
-it \

View File

@ -1,12 +1,3 @@
docker build \
-t guilledk/skynet:runtime \
-f docker/Dockerfile.runtime .
docker build \
-t guilledk/skynet:runtime-frontend \
-f docker/Dockerfile.runtime+frontend .
docker build \
-t guilledk/skynet:runtime-cuda-py311 \
-f docker/Dockerfile.runtime+cuda-py311 .
@ -14,7 +5,3 @@ docker build \
docker build \
-t guilledk/skynet:runtime-cuda \
-f docker/Dockerfile.runtime+cuda-py311 .
docker build \
-t guilledk/skynet:runtime-cuda-py310 \
-f docker/Dockerfile.runtime+cuda-py310 .

4141
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -65,3 +65,7 @@ build-backend = 'poetry.core.masonry.api'
[tool.poetry.scripts]
skynet = 'skynet.cli:skynet'
txt2img = 'skynet.cli:txt2img'
img2img = 'skynet.cli:img2img'
upscale = 'skynet.cli:upscale'
inpaint = 'skynet.cli:inpaint'

View File

@ -18,7 +18,7 @@ MODELS = {
'nousr/robo-diffusion': {'short': 'robot', 'mem': 6, 'size': {'w': 512, 'h': 512}},
# -1 is always inpaint default
'diffusers/stable-diffusion-xl-1.0-inpainting-0.1': {'short': 'stablexl-inpainting': 'mem': 8.3, 'size': {'w': 1024, 'h': 1024}},
'diffusers/stable-diffusion-xl-1.0-inpainting-0.1': {'short': 'stablexl-inpainting', 'mem': 8.3, 'size': {'w': 1024, 'h': 1024}},
# default is always last
'stabilityai/stable-diffusion-xl-base-1.0': {'short': 'stablexl', 'mem': 8.3, 'size': {'w': 1024, 'h': 1024}},

View File

@ -18,6 +18,7 @@ from PIL import Image
from basicsr.archs.rrdbnet_arch import RRDBNet
from diffusers import (
DiffusionPipeline,
AutoPipelineForInpainting,
EulerAncestralDiscreteScheduler
)
from realesrgan import RealESRGANer
@ -58,6 +59,9 @@ def crop_image(image: Image, max_w: int, max_h: int) -> Image:
return image.convert('RGB')
def convert_from_bytes_and_crop(raw: bytes, max_w: int, max_h: int) -> Image:
return crop_image(convert_from_bytes_to_img(raw), max_w, max_h)
def pipeline_for(
model: str,
@ -205,7 +209,7 @@ def inpaint(
seed: Optional[int] = None
):
login(token=hf_token)
pipe = pipeline_for(model, image=True)
pipe = pipeline_for(model, image=True, inpainting=True)
model_info = MODELS[model]
@ -220,7 +224,7 @@ def inpaint(
image = pipe(
prompt,
image=input_img,
mask_image=mask_img
mask_image=mask_img,
strength=strength,
guidance_scale=guidance, num_inference_steps=steps,
generator=torch.Generator("cuda").manual_seed(seed)