Skip to content

Commit

Permalink
UPDATE+FIX: BasicSR lib built-in
Browse files Browse the repository at this point in the history
Due to a lot of issues caused by installation failures of bacisr (->future lib error) in Py311 enclosures
#136 #141 #152 #154
  • Loading branch information
Gourieff committed Dec 22, 2023
1 parent 4539081 commit f0e7fd7
Show file tree
Hide file tree
Showing 87 changed files with 16,137 additions and 57 deletions.
21 changes: 1 addition & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_NEW_EN.png?raw=true" alt="logo" width="180px"/>

![Version](https://img.shields.io/badge/node_version-0.4.1_beta2-green?style=for-the-badge&labelColor=darkgreen)
![Version](https://img.shields.io/badge/node_version-0.4.1_beta3-green?style=for-the-badge&labelColor=darkgreen)

<sup>
<font color=brightred>
Expand Down Expand Up @@ -61,25 +61,6 @@

<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.1-whatsnew-01.jpg?raw=true" alt="0.4.1-whatsnew-01" width="100%"/>

After update you may encounter the following error:<br>
`ModuleNotFoundError: No module named 'basicsr'`<br>
The reason is that ComfyUI doesn't have "basicsr" lib by default - but without this lib CodeFormer doesn't have all its options available to user.<br>
To install this package you should run "install.bat" (inside ReActor's folder) or do it manually from ComfyUI root:

python_embeded\python.exe -m pip install basicsr

If you see errors with building "future-0.18.3" package, do the following:

- Download https://github.com/Gourieff/Assets/raw/main/comfyui-reactor-node/future-0.18.3-py3-none-any.whl<br>

- Put it to ComfyUI root and run:

python_embeded\python.exe -m pip install future-0.18.3-py3-none-any.whl

- Then:

python_embeded\python.exe -m pip install basicsr

### 0.4.0

- Input "input_image" goes first now, it gives a correct bypass and also it is right to have the main input first;
Expand Down
21 changes: 1 addition & 20 deletions README_RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_NEW_RU.png?raw=true" alt="logo" width="180px"/>

![Version](https://img.shields.io/badge/версия_нода-0.4.1_beta2-green?style=for-the-badge&labelColor=darkgreen)
![Version](https://img.shields.io/badge/версия_нода-0.4.1_beta3-green?style=for-the-badge&labelColor=darkgreen)

<sup>
<font color=brightred>
Expand Down Expand Up @@ -61,25 +61,6 @@

<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.1-whatsnew-01.jpg?raw=true" alt="0.4.1-whatsnew-01" width="100%"/>

После обновления вы можете столкнуться со следующей ошибкой:<br>
`ModuleNotFoundError: No module named 'basicsr'`<br>
Причина в том, что ComfyUI не включает по умолчанию в свой состав библиотеку "basicsr" - но без этой библиотеки пользователю не достурны все опции инструмента CodeFormer.<br>
Для того, чтобы установить этот пакет, запустите "install.bat" (внутри папки ReActor) или установите вручную из корневой директории ComfyUI:

python_embeded\python.exe -m pip install basicsr

Если вы видите ошибки, связанные с пакетом "future-0.18.3", сделайте следующее:

- Скачайте https://github.com/Gourieff/Assets/raw/main/comfyui-reactor-node/future-0.18.3-py3-none-any.whl<br>

- Скопируйте файл в корневую папку ComfyUI и выполните в консоли:

python_embeded\python.exe -m pip install future-0.18.3-py3-none-any.whl

- Затем:

python_embeded\python.exe -m pip install basicsr

### 0.4.0

- Вход "input_image" теперь идёт первым, это даёт возможность корректного байпаса, а также это правильно с точки зрения расположения входов (главный вход - первый);
Expand Down
12 changes: 12 additions & 0 deletions basicsr/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# https://github.com/xinntao/BasicSR
# flake8: noqa
from .archs import *
from .data import *
from .losses import *
from .metrics import *
from .models import *
from .ops import *
from .test import *
from .train import *
from .utils import *
from .version import __gitsha__, __version__
25 changes: 25 additions & 0 deletions basicsr/archs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import importlib
from copy import deepcopy
from os import path as osp

from basicsr.utils import get_root_logger, scandir
from basicsr.utils.registry import ARCH_REGISTRY

__all__ = ['build_network']

# automatically scan and import arch modules for registry
# scan all the files under the 'archs' folder and collect files ending with
# '_arch.py'
arch_folder = osp.dirname(osp.abspath(__file__))
arch_filenames = [osp.splitext(osp.basename(v))[0] for v in scandir(arch_folder) if v.endswith('_arch.py')]
# import all the arch modules
_arch_modules = [importlib.import_module(f'basicsr.archs.{file_name}') for file_name in arch_filenames]


def build_network(opt):
opt = deepcopy(opt)
network_type = opt.pop('type')
net = ARCH_REGISTRY.get(network_type)(**opt)
logger = get_root_logger()
logger.info(f'Network [{net.__class__.__name__}] is created.')
return net
Loading

0 comments on commit f0e7fd7

Please sign in to comment.