diff --git a/apps/shark_studio/api/sd.py b/apps/shark_studio/api/sd.py index 85599fe8..a55f75ed 100644 --- a/apps/shark_studio/api/sd.py +++ b/apps/shark_studio/api/sd.py @@ -164,8 +164,7 @@ class StableDiffusion: devices = backend targets = target max_length = 64 - - self.pipe_id = "_".join(pipe_id_list) + self.pipeline_dir = Path(os.path.join(get_checkpoints_path(), "vmfbs")) self.weights_path = Path(os.path.join(get_checkpoints_path(), "weights")) if not os.path.exists(self.pipeline_dir): @@ -348,18 +347,13 @@ def shark_sd_fn_dict_input(sd_kwargs: dict, *, progress=gr.Progress()): if not sd_kwargs["device"]: gr.Warning("No device specified. Please specify a device.") return None, "" - if sd_kwargs["height"] != 512 and sd_kwargs["width"] != 512 and sd_kwargs["base_model_id"] == "stabilityai/sdxl-turbo": - gr.Warning("SDXL turbo output size must be 512x512. This is a temporary limitation.") - return None, "" if sd_kwargs["base_model_id"] == "stabilityai/sdxl-turbo": if sd_kwargs["steps"] > 10: - gr.Warning("Max steps for sdxl-turbo is 10. 1 to 4 steps are recommended.") - return None, "" + gr.Warning("1 to 4 steps are recommended for sdxl-turbo, unless you are using a custom checkpoint.") if sd_kwargs["guidance_scale"] > 3: gr.Warning( - "sdxl-turbo CFG scale should be less than 2.0 if using negative prompt, 0 otherwise." + "sdxl-turbo CFG scale should be between 1.0 and 2.0 if using negative prompt, 0 otherwise." ) - return None, "" if sd_kwargs["target_triple"] == "": if not parse_device(sd_kwargs["device"], sd_kwargs["target_triple"])[1]: gr.Warning( diff --git a/apps/shark_studio/modules/ckpt_processing.py b/apps/shark_studio/modules/ckpt_processing.py index 9f75c8dd..6ca402e9 100644 --- a/apps/shark_studio/modules/ckpt_processing.py +++ b/apps/shark_studio/modules/ckpt_processing.py @@ -65,7 +65,10 @@ def preprocessCKPT(custom_weights, precision="fp16", is_inpaint=False): def save_irpa(weights_path, prepend_str, remove_str=None): - weights = safetensors.torch.load_file(weights_path) + try: + weights = safetensors.torch.load_file(weights_path) + except: + weights = safetensors.numpy.load_file(weights_path) archive = ParameterArchiveBuilder() for key in weights.keys(): if remove_str: diff --git a/requirements.txt b/requirements.txt index 16d6712a..c51c2e88 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ setuptools wheel -torch>=2.3.0 +torch>2.4.1 shark-turbine @ git+https://github.com/iree-org/iree-turbine.git@main turbine-models @ git+https://github.com/nod-ai/SHARK-Turbine.git@ean-unify-sd#subdirectory=models diffusers @ git+https://github.com/nod-ai/diffusers@0.29.0.dev0-shark @@ -29,7 +29,7 @@ parameterized #accelerate is now required for diffusers import from ckpt. accelerate scipy -transformers==4.37.1 +transformers torchsde # Required for Stable Diffusion SDE schedulers. ftfy gradio==4.29.0 diff --git a/setup_venv.ps1 b/setup_venv.ps1 index 2ef307a4..a910887b 100644 --- a/setup_venv.ps1 +++ b/setup_venv.ps1 @@ -89,7 +89,7 @@ else {python -m venv .\shark.venv\} python -m pip install --upgrade pip pip install wheel pip install --pre -r requirements.txt -pip install https://github.com/nod-ai/SRT/releases/download/candidate-20240617.289/iree_compiler-20240617.289-cp311-cp311-win_amd64.whl https://github.com/nod-ai/SRT/releases/download/candidate-20240617.289/iree_runtime-20240617.289-cp311-cp311-win_amd64.whl +pip install https://github.com/nod-ai/SRT/releases/download/candidate-20240619.291/iree_compiler-20240619.291-cp311-cp311-win_amd64.whl https://github.com/nod-ai/SRT/releases/download/candidate-20240619.291/iree_runtime-20240619.291-cp311-cp311-win_amd64.whl pip install -e . Write-Host "Source your venv with ./shark.venv/Scripts/activate"