Skip to content

Commit

Permalink
Full RTX Support
Browse files Browse the repository at this point in the history
Remove FFMPEG from Conda Requirements
Fix Tensorboard logging for Tensorflow 1.13.1
Bump default Conda Tensorflow to 1.13.1
Update max python version to 3.7
  • Loading branch information
torzdf committed Jun 12, 2019
1 parent f117846 commit b03f448
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
10 changes: 5 additions & 5 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ It's good to keep faceswap up to date as new features are added and bugs are fix

# General Install Guide
## Installing dependencies
- Python >= 3.2-3.6 64-bit (cannot be 3.7.x as Tensorflow has not been updated to provide support)
- Python >= 3.2-3.7 64-bit
- apt/yum install python3 (Linux)
- [Installer](https://www.python.org/downloads/release/python-368/) (Windows)
- [brew](https://brew.sh/) install python3 (macOS)
Expand Down Expand Up @@ -181,13 +181,13 @@ INFO CUDA Enabled
INFO 1. Install Docker
https://www.docker.com/community-edition
2. Install Nvidia-Docker & Restart Docker Service
1. Install Nvidia-Docker & Restart Docker Service
https://github.com/NVIDIA/nvidia-docker
3. Build Docker Image For Faceswap
1. Build Docker Image For Faceswap
docker build -t deepfakes-gpu -f Dockerfile.gpu .
4. Mount faceswap volume and Run it
1. Mount faceswap volume and Run it
# without gui. tools.py gui not working.
nvidia-docker run --rm -it -p 8888:8888 \
--hostname faceswap-gpu --name faceswap-gpu \
Expand All @@ -211,7 +211,7 @@ INFO 1. Install Docker
-e UID=`id -u` \
deepfakes-gpu
5. Open a new terminal to interact with the project
1. Open a new terminal to interact with the project
docker exec faceswap-gpu python /srv/faceswap.py gui
```

Expand Down
23 changes: 17 additions & 6 deletions plugins/train/trainer/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import cv2
import numpy as np

from tensorflow import keras as tf_keras
import tensorflow as tf

from lib.alignments import Alignments
from lib.faces_detect import DetectedFace
Expand Down Expand Up @@ -113,22 +113,33 @@ def set_tensorboard(self):

logger.debug("Enabling TensorBoard Logging")
tensorboard = dict()

for side in self.sides:
logger.debug("Setting up TensorBoard Logging. Side: %s", side)
log_dir = os.path.join(str(self.model.model_dir),
"{}_logs".format(self.model.name),
side,
"session_{}".format(self.model.state.session_id))
tbs = tf_keras.callbacks.TensorBoard(log_dir=log_dir,
histogram_freq=0, # Must be 0 or hangs
batch_size=self.batch_size,
write_graph=True,
write_grads=True)
tbs = tf.keras.callbacks.TensorBoard(log_dir=log_dir, **self.tensorboard_kwargs)
tbs.set_model(self.model.predictors[side])
tensorboard[side] = tbs
logger.info("Enabled TensorBoard Logging")
return tensorboard

@property
def tensorboard_kwargs(self):
""" TF 1.13 + needs an additional kwarg which is not valid for earlier versions """
kwargs = dict(histogram_freq=0, # Must be 0 or hangs
batch_size=64,
write_graph=True,
write_grads=True)
tf_version = [int(ver) for ver in tf.__version__.split(".")]
logger.debug("Tensorflow version: %s", tf_version)
if tf_version[0] > 1 or (tf_version[0] == 1 and tf_version[1] > 12):
kwargs["update_freq"] = "batch"
logger.debug(kwargs)
return kwargs

def print_loss(self, loss):
""" Override for specific model loss formatting """
logger.trace(loss)
Expand Down
2 changes: 1 addition & 1 deletion scripts/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def get_trainer(self, model_dir):
if fname.endswith("_state.json")]
if len(statefile) != 1:
logger.error("There should be 1 state file in your model folder. %s were found. "
"Specify a trainer with the '-t', '--trainer' option.")
"Specify a trainer with the '-t', '--trainer' option.", len(statefile))
exit(1)
statefile = os.path.join(str(model_dir), statefile[0])

Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Environment():
""" The current install environment """
def __init__(self):
self.macos_required_packages = ["pynvx==0.0.4"]
self.conda_required_packages = [("ffmpeg", "conda-forge"), ("tk", )]
self.conda_required_packages = [("tk", )]
self.output = Output()
# Flag that setup is being run by installer so steps can be skipped
self.is_installer = False
Expand Down Expand Up @@ -138,10 +138,10 @@ def check_python(self):
self.output.info("Installed Python: {0} {1}".format(self.py_version[0],
self.py_version[1]))
if not (self.py_version[0].split(".")[0] == "3"
and self.py_version[0].split(".")[1] in ("3", "4", "5", "6")
and self.py_version[0].split(".")[1] in ("3", "4", "5", "6", "7")
and self.py_version[1] == "64bit"):
self.output.error("Please run this script with Python version 3.3, 3.4, 3.5 or 3.6 "
"64bit and try again.")
self.output.error("Please run this script with Python version 3.3, 3.4, 3.5, 3.6 or "
"3.7 64bit and try again.")
exit(1)

def output_runtime_info(self):
Expand Down Expand Up @@ -253,9 +253,9 @@ def update_tf_dep(self):
def update_tf_dep_conda(self):
""" Update Conda TF Dependency """
if not self.enable_cuda:
self.required_packages.append("tensorflow==1.12.0")
self.required_packages.append("tensorflow==1.13.1")
else:
self.required_packages.append("tensorflow-gpu==1.12.0")
self.required_packages.append("tensorflow-gpu==1.13.1")


class Output():
Expand Down

0 comments on commit b03f448

Please sign in to comment.