Unverified Commit b7c5b30f authored by AUTOMATIC1111's avatar AUTOMATIC1111 Committed by GitHub
Browse files

Merge branch 'dev' into master

parents 14501f56 262ec8ec
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ jobs:
          #     not to have GHA download an (at the time of writing) 4 GB cache
          #     of PyTorch and other dependencies.
      - name: Install Ruff
        run: pip install ruff==0.0.265
        run: pip install ruff==0.0.272
      - name: Run Ruff
        run: ruff .
  lint-js:
+2 −2
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ jobs:
          --no-half
          --disable-opt-split-attention
          --use-cpu all
          --add-stop-route
          --api-server-stop
          2>&1 | tee output.txt &
      - name: Run tests
        run: |
@@ -50,7 +50,7 @@ jobs:
          python -m pytest -vv --junitxml=test/results.xml --cov . --cov-report=xml --verify-base-url test
      - name: Kill test server
        if: always()
        run: curl -vv -XPOST http://127.0.0.1:7860/_stop && sleep 10
        run: curl -vv -XPOST http://127.0.0.1:7860/sdapi/v1/server-stop && sleep 10
      - name: Show coverage
        run: |
          python -m coverage combine .coverage*
+3 −0
Original line number Diff line number Diff line
@@ -135,8 +135,11 @@ Find the instructions [here](https://github.com/AUTOMATIC1111/stable-diffusion-w
Here's how to add code to this repo: [Contributing](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Contributing)

## Documentation

The documentation was moved from this README over to the project's [wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki).

For the purposes of getting Google and other search engines to crawl the wiki, here's a link to the (not for humans) [crawlable wiki](https://github-wiki-see.page/m/AUTOMATIC1111/stable-diffusion-webui/wiki).

## Credits
Licenses for borrowed code can be found in `Settings -> Licenses` screen, and also in `html/licenses.html` file.

+3 −5
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ import safetensors.torch

from ldm.models.diffusion.ddim import DDIMSampler
from ldm.util import instantiate_from_config, ismap
from modules import shared, sd_hijack
from modules import shared, sd_hijack, devices

cached_ldsr_model: torch.nn.Module = None

@@ -112,8 +112,7 @@ class LDSR:


        gc.collect()
        if torch.cuda.is_available:
            torch.cuda.empty_cache()
        devices.torch_gc()

        im_og = image
        width_og, height_og = im_og.size
@@ -150,8 +149,7 @@ class LDSR:

        del model
        gc.collect()
        if torch.cuda.is_available:
            torch.cuda.empty_cache()
        devices.torch_gc()

        return a

+8 −12
Original line number Diff line number Diff line
import os

from basicsr.utils.download_util import load_file_from_url

from modules.modelloader import load_file_from_url
from modules.upscaler import Upscaler, UpscalerData
from ldsr_model_arch import LDSR
from modules import shared, script_callbacks, errors
@@ -43,20 +42,17 @@ class UpscalerLDSR(Upscaler):
        if local_safetensors_path is not None and os.path.exists(local_safetensors_path):
            model = local_safetensors_path
        else:
            model = local_ckpt_path if local_ckpt_path is not None else load_file_from_url(url=self.model_url, model_dir=self.model_download_path, file_name="model.ckpt", progress=True)
            model = local_ckpt_path or load_file_from_url(self.model_url, model_dir=self.model_download_path, file_name="model.ckpt")

        yaml = local_yaml_path if local_yaml_path is not None else load_file_from_url(url=self.yaml_url, model_dir=self.model_download_path, file_name="project.yaml", progress=True)
        yaml = local_yaml_path or load_file_from_url(self.yaml_url, model_dir=self.model_download_path, file_name="project.yaml")

        try:
        return LDSR(model, yaml)
        except Exception:
            errors.report("Error importing LDSR", exc_info=True)
        return None

    def do_upscale(self, img, path):
        try:
            ldsr = self.load_model(path)
        if ldsr is None:
            print("NO LDSR!")
        except Exception:
            errors.report(f"Failed loading LDSR model {path}", exc_info=True)
            return img
        ddim_steps = shared.opts.ldsr_steps
        return ldsr.super_resolution(img, ddim_steps, self.scale)
Loading