diff --git a/skynet/cli.py b/skynet/cli.py index f78d31d..4a5850e 100755 --- a/skynet/cli.py +++ b/skynet/cli.py @@ -45,7 +45,7 @@ def skynet(*args, **kwargs): @click.option('--steps', '-s', default=26) @click.option('--seed', '-S', default=None) def txt2img(*args, **kwargs): - from . import utils # TODO? why here, import cycle? + from skynet.dgpu import utils config = load_skynet_toml() set_hf_vars(config.dgpu.hf_token, config.dgpu.hf_home) @@ -70,7 +70,7 @@ def txt2img(*args, **kwargs): @click.option('--steps', '-s', default=26) @click.option('--seed', '-S', default=None) def img2img(model, prompt, input, output, strength, guidance, steps, seed): - from . import utils + from skynet.dgpu import utils config = load_skynet_toml() set_hf_vars(config.dgpu.hf_token, config.dgpu.hf_home) utils.img2img( @@ -98,7 +98,7 @@ def img2img(model, prompt, input, output, strength, guidance, steps, seed): @click.option('--steps', '-s', default=26) @click.option('--seed', '-S', default=None) def inpaint(model, prompt, input, mask, output, strength, guidance, steps, seed): - from . import utils + from skynet.dgpu import utils config = load_skynet_toml() set_hf_vars(config.dgpu.hf_token, config.dgpu.hf_home) utils.inpaint( @@ -119,7 +119,7 @@ def inpaint(model, prompt, input, mask, output, strength, guidance, steps, seed) @click.option('--output', '-o', default='output.png') @click.option('--model', '-m', default='weights/RealESRGAN_x4plus.pth') def upscale(input, output, model): - from . import utils + from skynet.dgpu import utils utils.upscale( img_path=input, output=output, @@ -128,7 +128,7 @@ def upscale(input, output, model): @skynet.command() def download(): - from . import utils + from skynet.dgpu import utils config = load_skynet_toml() set_hf_vars(config.dgpu.hf_token, config.dgpu.hf_home) utils.download_all_models(config.dgpu.hf_token, config.dgpu.hf_home) diff --git a/skynet/dgpu/compute.py b/skynet/dgpu/compute.py index 23daa63..67bc7ea 100755 --- a/skynet/dgpu/compute.py +++ b/skynet/dgpu/compute.py @@ -19,7 +19,7 @@ from skynet.dgpu.errors import ( DGPUInferenceCancelled, ) -from skynet.utils import crop_image, convert_from_cv2_to_image, convert_from_image_to_cv2, convert_from_img_to_bytes, init_upscaler, pipeline_for +from skynet.dgpu.utils import crop_image, convert_from_cv2_to_image, convert_from_image_to_cv2, convert_from_img_to_bytes, init_upscaler, pipeline_for def prepare_params_for_diffuse( diff --git a/skynet/utils.py b/skynet/dgpu/utils.py similarity index 99% rename from skynet/utils.py rename to skynet/dgpu/utils.py index 0ebf6fb..31d0797 100755 --- a/skynet/utils.py +++ b/skynet/dgpu/utils.py @@ -23,7 +23,7 @@ from diffusers import ( ) from huggingface_hub import login -from .constants import MODELS +from skynet.constants import MODELS # Hack to fix a changed import in torchvision 0.17+, which otherwise breaks # basicsr; see https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/13985