Skip to content

Commit fa79d4d

Browse files
authored
Initializers to Torch (#1549)
* Update requirements * Remove docker * ICNR init to torch * conv-aware: Output as Tensor rather than Variable * Bugfix: Omit type object from automodsumm * bugfix: Tensorboard unit test. Switch Sequential for Functional * Suppress broken Keras test * revert failing test
1 parent 6923cd2 commit fa79d4d

21 files changed

Lines changed: 387 additions & 715 deletions

.dockerignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
!/requirements/*.py
1111

1212
# Root files
13-
!Dockerfile*
1413
!pyproject.toml
1514
!.gitignore
1615
!.travis.yml

Dockerfile.cpu

Lines changed: 0 additions & 19 deletions
This file was deleted.

Dockerfile.gpu

Lines changed: 0 additions & 18 deletions
This file was deleted.

INSTALL.md

Lines changed: 3 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
- [Getting the faceswap code](#getting-the-faceswap-code)
3939
- [Setup](#setup-2)
4040
- [About some of the options](#about-some-of-the-options)
41-
- [Docker Install Guide](#docker-install-guide)
42-
- [Docker CPU](#docker-cpu)
43-
- [Docker Nvidia](#docker-nvidia)
4441
- [Run the project](#run-the-project)
4542
- [Notes](#notes)
4643

@@ -74,8 +71,6 @@ The type of computations that the process does are well suited for graphics card
7471
Intel based macOS systems should work, but you will need to follow the [Manual Install](#manual-install) instructions.
7572
- All operating systems must be 64-bit.
7673

77-
Alternatively, there is a docker image that is based on Debian.
78-
7974
# Important before you proceed
8075
**In its current iteration, the project relies heavily on the use of the command line, although a gui is available. if you are unfamiliar with command line tools, you may have difficulty setting up the environment and should perhaps not attempt any of the steps described in this guide.** This guide assumes you have intermediate knowledge of the command line.
8176

@@ -131,7 +126,7 @@ To enter the virtual environment:
131126
- If you have issues/errors follow the Manual install steps below.
132127

133128
#### Manual install
134-
Do not follow these steps if the Easy Install above completed succesfully.
129+
Do not follow these steps if the Easy Install above completed successfully.
135130
If you are using an Nvidia card make sure you have the correct versions of Cuda/cuDNN installed for the required version of Torch
136131
- Install tkinter (required for the GUI) by typing: `conda install tk`
137132
- Install requirements:
@@ -251,7 +246,7 @@ Alternatively you can install Python (3.14 64-bit) for your distribution (links
251246

252247
If using Conda3 then setting up virtual environments is relatively straight forward. More information can be found at [Conda Docs](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)
253248

254-
If using a default Python distribution then [virtualenv](https://github.com/pypa/virtualenv) and [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io) may help when you are not using docker.
249+
If using a default Python distribution then [virtualenv](https://github.com/pypa/virtualenv) and [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io) may help.
255250

256251

257252
## Getting the faceswap code
@@ -270,87 +265,8 @@ If setup fails for any reason you can still manually install the packages listed
270265

271266
### About some of the options
272267
- CUDA: For acceleration. Requires a good nVidia Graphics Card (which supports CUDA inside)
273-
- Docker: Provide a ready-made image. Hide trivial details. Get you straight to the project.
274-
- nVidia-Docker: Access to the nVidia GPU on host machine from inside container.
275-
276-
# Docker Install Guide
277-
278-
This Faceswap repo contains Docker build scripts for CPU and Nvidia backends. The scripts will set up a Docker container for you and install the latest version of the Faceswap software.
279-
280-
You must first ensure that Docker is installed and running on your system. Follow the guide for downloading and installing Docker from their website:
281-
282-
- https://www.docker.com/get-started
268+
- ROCm: For AMD GPUs under Linux/WSL2 only. Make sure you install the correct version of faceswap for your installed ROCm version
283269

284-
Once Docker is installed and running, follow the relevant steps for your chosen backend
285-
## Docker CPU
286-
To run the CPU version of Faceswap follow these steps:
287-
288-
1. Build the Docker image For faceswap:
289-
```
290-
docker build \
291-
-t faceswap-cpu \
292-
https://raw.githubusercontent.com/deepfakes/faceswap/master/Dockerfile.cpu
293-
```
294-
2. Launch and enter the Faceswap container:
295-
296-
a. For the **headless/command line** version of Faceswap run:
297-
```
298-
docker run --rm -it faceswap-cpu
299-
```
300-
You can then execute faceswap the standard way:
301-
```
302-
python faceswap.py --help
303-
```
304-
b. For the **GUI** version of Faceswap run:
305-
```
306-
xhost +local: && \
307-
docker run --rm -it \
308-
-v /tmp/.X11-unix:/tmp/.X11-unix \
309-
-e DISPLAY=${DISPLAY} \
310-
faceswap-cpu
311-
```
312-
You can then launch the GUI with
313-
```
314-
python faceswap.py gui
315-
```
316-
## Docker Nvidia
317-
To build the NVIDIA GPU version of Faceswap, follow these steps:
318-
319-
1. Nvidia Docker builds need extra resources to provide the Docker container with access to your GPU.
320-
321-
a. Follow the instructions to install and apply the `Nvidia Container Toolkit` for your distribution from:
322-
- https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
323-
324-
b. If Docker is already running, restart it to pick up the changes made by the Nvidia Container Toolkit.
325-
326-
2. Build the Docker image For faceswap
327-
```
328-
docker build \
329-
-t faceswap-gpu \
330-
https://raw.githubusercontent.com/deepfakes/faceswap/master/Dockerfile.gpu
331-
```
332-
1. Launch and enter the Faceswap container:
333-
334-
a. For the **headless/command line** version of Faceswap run:
335-
```
336-
docker run --runtime=nvidia --rm -it faceswap-gpu
337-
```
338-
You can then execute faceswap the standard way:
339-
```
340-
python faceswap.py --help
341-
```
342-
b. For the **GUI** version of Faceswap run:
343-
```
344-
xhost +local: && \
345-
docker run --runtime=nvidia --rm -it \
346-
-v /tmp/.X11-unix:/tmp/.X11-unix \
347-
-e DISPLAY=${DISPLAY} \
348-
faceswap-gpu
349-
```
350-
You can then launch the GUI with
351-
```
352-
python faceswap.py gui
353-
```
354270
# Run the project
355271
Once all these requirements are installed, you can attempt to run the faceswap tools. Use the `-h` or `--help` options for a list of options.
356272

lib/cli/launcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from lib.gpu_stats import GPUStats
1313
from lib.logger import crash_log, log_setup
14+
from lib.system.system import VALID_TORCH
1415
from lib.utils import (FaceswapError, get_backend, get_torch_version,
1516
get_module_objects, safe_shutdown, set_backend)
1617

@@ -77,8 +78,7 @@ def _test_for_torch_version(self) -> None:
7778
FaceswapError
7879
If PyTorch is not found, or is not between versions 2.3 and 2.11
7980
"""
80-
min_ver = (2, 3)
81-
max_ver = (2, 11)
81+
min_ver, max_ver = VALID_TORCH
8282
try:
8383
import torch # noqa:F401 pylint:disable=unused-import,import-outside-toplevel
8484
except ImportError as err:

0 commit comments

Comments
 (0)