GithubHelp home page GithubHelp logo

soulteary / docker-gfpgan Goto Github PK

View Code? Open in Web Editor NEW
40.0 2.0 9.0 1.15 MB

TencentARC GFPGAN ALL-IN-ONE Docker Images. support x86 / ARM.

Home Page: https://soulteary.com/2022/05/20/use-docker-to-run-huggingface-models.html

License: Apache License 2.0

Dockerfile 4.00% Python 94.74% Shell 1.26%
docker gfpgan x86 arm m1-mac stable-diffusion-webui

docker-gfpgan's Introduction

Docker GFPGAN

腾讯 ARC 实验室 GFPGAN Docker 运行方案。

如果需要 CPU 运行,请参考第一篇教程,如果希望生产使用或 GPU 运行,请参考第二篇教程。

项目预览

第二篇教程相关:

第一篇教程相关:

使用方法

下载代码,执行脚本,构建镜像:

git clone https://github.com/soulteary/docker-gfpgan.git
cd docker-gfpgan
bash scripts/build.sh

在完成基础镜像构建之后,可以从网盘下载 models.zip

模型应用运行需要的所有模型都在这里了,下载完毕后,解压缩模型压缩包,将 gfpgan、model 两个目录放置到项目的根目录中,完整的项目结构是这样的:

├── docker
├── gfpgan
│   └── weights
│       ├── detection_Resnet50_Final.pth
│       └── parsing_parsenet.pth
├── LICENSE
├── model
│   ├── GFPGANCleanv1-NoCE-C2.pth
│   ├── GFPGANv1.2.pth
│   ├── GFPGANv1.3.pth
│   ├── GFPGANv1.4.pth
│   ├── GFPGANv1.pth
│   ├── README.md
│   ├── RealESRGAN_x2plus.pth
│   ├── realesr-general-x4v3.pth
│   └── RestoreFormer.pth
├── README.md
├── scripts
└── src

准备好模型文件之后,使用下面的命令启动模型应用:

docker run --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 --rm -it -v `pwd`/model:/app/model -v `pwd`/gfpgan:/app/gfpgan  -p 7860:7860 soulteary/docker-gfpgan

稍等片刻,我们将看到类似下面的日志:

Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.

接着,我们就可以打开浏览器访问 http://localhost:7860 或者 http://你的IP地址:7860 来试试看啦。

相关教程

相关项目

docker-gfpgan's People

Contributors

soulteary avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

docker-gfpgan's Issues

Won't mount in Docker

After pulling, the models will not mount. The container exits with the following error:

Traceback (most recent call last): File "/entrypoint.py", line 22, in <module> towhee.glob['path']('*.jpg') File "/opt/conda/lib/python3.9/site-packages/towhee/hparam/hyperparameter.py", line 198, in __call__ return self._func(*args, **kws) File "/opt/conda/lib/python3.9/site-packages/towhee/functional/data_collection.py", line 652, in wrapper return self.map(op) File "/opt/conda/lib/python3.9/site-packages/towhee/functional/data_collection.py", line 343, in map if hasattr(unary_op, 'is_stateful') and unary_op.is_stateful: File "/opt/conda/lib/python3.9/site-packages/towhee/engine/factory.py", line 121, in is_stateful self.__check_init__() File "/opt/conda/lib/python3.9/site-packages/towhee/engine/factory.py", line 71, in __check_init__ self._op = op(self._name, self._tag, **self._kws) File "/opt/conda/lib/python3.9/site-packages/towhee/engine/factory.py", line 50, in op op_obj = loader.load_operator(operator_src, kwargs, tag) File "/opt/conda/lib/python3.9/site-packages/towhee/engine/operator_loader.py", line 150, in load_operator op = factory(function, args, tag) File "/opt/conda/lib/python3.9/site-packages/towhee/engine/operator_loader.py", line 60, in load_operator_from_registry return self.instance_operator(op, args) if op is not None else None File "/opt/conda/lib/python3.9/site-packages/towhee/engine/operator_loader.py", line 160, in instance_operator return op(**args) if args is not None else op() File "/entrypoint.py", line 13, in __init__ self._restorer = GFPGANer(model_path, upscale, arch, channel_multiplier, bg_upsampler) File "/opt/conda/lib/python3.9/site-packages/gfpgan/utils.py", line 87, in __init__ loadnet = torch.load(model_path) File "/opt/conda/lib/python3.9/site-packages/torch/serialization.py", line 594, in load with _open_file_like(f, 'rb') as opened_file: File "/opt/conda/lib/python3.9/site-packages/torch/serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "/opt/conda/lib/python3.9/site-packages/torch/serialization.py", line 211, in __init__ super(_open_file, self).__init__(open(name, mode)) IsADirectoryError: [Errno 21] Is a directory: '/GFPGAN.pth'

Windows?

Hi
Can I built this on windows?
If yes, how?
And is the model the same as on the original gfpgan?
Is background real esrgan also included?

Thanks for any help!

Link for GPU

hi pal thanks for blog !can you send me the link for GPU and how to depoly as a Api

IndexError: list index out of range when running

I have executed commands from the README.md and #2
docker pull soulteary/docker-gfpgan
cd docker-gfpgan/model
wget https://github.com/TencentARC/GFPGAN/releases/download/v0.2.0/GFPGANCleanv1-NoCE-C2.pth
cd ..
docker run --rm -it -v `pwd`/model/GFPGANCleanv1-NoCE-C2.pth:/GFPGAN.pth -v `pwd`/data:/data soulteary/docker-gfpgan:2022.05.20
But got this error when running:

Traceback (most recent call last): File "/entrypoint.py", line 22, in <module> towhee.glob['path']('*.jpg') File "/opt/conda/lib/python3.9/site-packages/towhee/functional/mixins/display.py", line 157, in show header = tuple(contents[0].__dict__) if not header else header IndexError: list index out of range
Is there any way to fix it?

Issue running docker image

Hello!

I'm having some trouble when I try to follow your instructions. I

  1. Installed docker
  2. Ran sudo docker pull soulteary/docker-gfpgan
  3. Ran sudo docker run --rm -it -v pwd/model/GFPGANCleanv1-NoCE-C2.pth:/GFPGAN.pth -v pwd/data:/data soulteary/docker-gfpgan:2022.05.20

I then got the following error message:
Traceback (most recent call last): File "/entrypoint.py", line 22, in <module> towhee.glob['path']('*.jpg') File "/opt/conda/lib/python3.9/site-packages/towhee/hparam/hyperparameter.py", line 198, in __call__ return self._func(*args, **kws) File "/opt/conda/lib/python3.9/site-packages/towhee/functional/data_collection.py", line 652, in wrapper return self.map(op) File "/opt/conda/lib/python3.9/site-packages/towhee/functional/data_collection.py", line 343, in map if hasattr(unary_op, 'is_stateful') and unary_op.is_stateful: File "/opt/conda/lib/python3.9/site-packages/towhee/engine/factory.py", line 121, in is_stateful self.__check_init__() File "/opt/conda/lib/python3.9/site-packages/towhee/engine/factory.py", line 71, in __check_init__ self._op = op(self._name, self._tag, **self._kws) File "/opt/conda/lib/python3.9/site-packages/towhee/engine/factory.py", line 50, in op op_obj = loader.load_operator(operator_src, kwargs, tag) File "/opt/conda/lib/python3.9/site-packages/towhee/engine/operator_loader.py", line 150, in load_operator op = factory(function, args, tag) File "/opt/conda/lib/python3.9/site-packages/towhee/engine/operator_loader.py", line 60, in load_operator_from_registry return self.instance_operator(op, args) if op is not None else None File "/opt/conda/lib/python3.9/site-packages/towhee/engine/operator_loader.py", line 160, in instance_operator return op(**args) if args is not None else op() File "/entrypoint.py", line 13, in __init__ self._restorer = GFPGANer(model_path, upscale, arch, channel_multiplier, bg_upsampler) File "/opt/conda/lib/python3.9/site-packages/gfpgan/utils.py", line 87, in __init__ loadnet = torch.load(model_path) File "/opt/conda/lib/python3.9/site-packages/torch/serialization.py", line 594, in load with _open_file_like(f, 'rb') as opened_file: File "/opt/conda/lib/python3.9/site-packages/torch/serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "/opt/conda/lib/python3.9/site-packages/torch/serialization.py", line 211, in __init__ super(_open_file, self).__init__(open(name, mode)) IsADirectoryError: [Errno 21] Is a directory: '/GFPGAN.pth'

I haven't really used docker before, may I ask how to proceed to debug this?

Thanks!

Not Found [IP: 101.6.15.130 80]

你好!非常感谢你分享了这么优秀的内容。但我按照你说的方法,在腾讯云服务器中使用docker编译,却收到了如下的错误。
编译命令:docker build -t soulteary/docker-gfpgan .
收到错误:
Step 5/10 : RUN apt install -y curl && curl -L "https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth" -o "/opt/conda/lib/python3.9/site-packages/facexlib/weights/detection_Resnet50_Final.pth" && apt remove -y curl
---> Running in 3842eac08f50

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
libcurl4
The following NEW packages will be installed:
curl libcurl4
0 upgraded, 2 newly installed, 0 to remove and 4 not upgraded.
Need to get 608 kB of archives.
After this operation, 1186 kB of additional disk space will be used.
Err:1 http://mirrors.tuna.tsinghua.edu.cn/debian bullseye/main amd64 libcurl4 amd64 7.74.0-1.3+deb11u1
404 Not Found [IP: 101.6.15.130 80]
Err:2 http://mirrors.tuna.tsinghua.edu.cn/debian bullseye/main amd64 curl amd64 7.74.0-1.3+deb11u1
404 Not Found [IP: 101.6.15.130 80]
E: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/pool/main/c/curl/libcurl4_7.74.0-1.3%2bdeb11u1_amd64.deb 404 Not Found [IP: 101.6.15.130 80]
E: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/debian/pool/main/c/curl/curl_7.74.0-1.3%2bdeb11u1_amd64.deb 404 Not Found [IP: 101.6.15.130 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt install -y curl && curl -L "https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth" -o "/opt/conda/lib/python3.9/site-packages/facexlib/weights/detection_Resnet50_Final.pth" && apt remove -y curl' returned a non-zero code: 100

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.