How to run the demo on pytorch 1.4.0 or 1.1.0? #19

Closed
opened 2026-01-29 21:37:05 +00:00 by claunia · 2 comments
Owner

Originally created by @willyzw1221 on GitHub (Jul 6, 2021).

Originally created by @willyzw1221 on GitHub (Jul 6, 2021).
Author
Owner

@xinntao commented on GitHub (Jul 7, 2021):

I have not tested it on pytorch1.4 or 1.1.
You may adapt to that version.

@xinntao commented on GitHub (Jul 7, 2021): I have not tested it on pytorch1.4 or 1.1. You may adapt to that version.
Author
Owner

@remixer-dec commented on GitHub (Jul 20, 2021):

I managed to run it with Pytorch 1.3 since it's the latest build that supports my GPU. Windows 8.1, Python 3.7, CUDA 10.2
You need to:

  1. Install basicsr, I already had it installed. If I remember correctly, I cloned the repo and modified requirements.txt to change pytorch version, and executed pip install -e /path/to/basicsr
    If you have version error with basicsr, just remove the line with version from basicsr/__init__.py
  2. Run pip install ninja
  3. Go to your python installation path, lib/site-packages/ and fix torch/hub.py , add
def get_dir():
    return hub_dir 
#required by facexlib,  implemented only in Pytorch 1.6+
  1. Run pip install facexlib
  2. Edit requirements.txt to exclude fresh pytorch, then run pip install -r requirements.txt
  3. Similar to step 3, fix torch/utils/cpp_extension.py
  • if you have utf-8 errors, change all decode() to decode('encoding-for-your-spoken-language')
  • in function _prepare_ldflags add extra_ldflags.append('c10_cuda.lib') near the other similar lines
  1. Run set BASICSR_JIT=True
  2. Run the py script from the Command Line Prompt of VS[YEAR] x64 Native Tools (Visual Studio Build Tools)
@remixer-dec commented on GitHub (Jul 20, 2021): I managed to run it with Pytorch 1.3 since it's the latest build that supports my GPU. Windows 8.1, Python 3.7, CUDA 10.2 You need to: 1) Install basicsr, I already had it installed. If I remember correctly, I cloned the repo and modified requirements.txt to change pytorch version, and executed ```pip install -e /path/to/basicsr``` If you have version error with basicsr, just remove the line with version from `basicsr/__init__.py` 2) Run ```pip install ninja``` 3) Go to your python installation path, lib/site-packages/ and fix _torch/hub.py_ , add ```python def get_dir(): return hub_dir #required by facexlib, implemented only in Pytorch 1.6+ ``` 4) Run ```pip install facexlib``` 5) Edit requirements.txt to exclude fresh pytorch, then run ```pip install -r requirements.txt``` 6) Similar to step 3, fix _torch/utils/cpp_extension.py_ - if you have utf-8 errors, change all ```decode()``` to ```decode('```_encoding-for-your-spoken-language_```')``` - in function `_prepare_ldflags` add ```extra_ldflags.append('c10_cuda.lib')``` near the other similar lines 7) Run ```set BASICSR_JIT=True``` 8) Run the py script from the Command Line Prompt of VS[_YEAR_] x64 Native Tools (Visual Studio Build Tools)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TencentARC/GFPGAN#19