Faceswap 3 open for testing

Discussions about research, Faceswapping and things that don't fit in the other categories here.


User avatar
torzdf
Posts: 2752
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 141 times
Been thanked: 643 times

Faceswap 3 open for testing

Post by torzdf »

Faceswap 3 is in Beta

Over the past few months I have been busy updating Faceswap to use Keras 3/PyTorch as its backend.

This is a major change, the reasons being that Tensorflow have made some baffling decisions of late that make it harder and harder to support going forward.

This has been a mammouth task, but ultimately, Faceswap will eventually switch over to this version at some point in the future, when all bugs are fixed and all features implemented.

Not yet implemented

In the meantime everything should work (including backwards compatibility) with the exception of:

  • Distributed training (this is on the roadmap to add prior to fully switching Faceswap over to PyTorch)
  • DirectML support. This may never be implemented, unless Keras 3 starts to support it. Ultimately, it is not possible to support this backend at present, so Windows users on AMD/Intel should stick with Faceswap 2

Implemented but untested

The following are implemented, but are untested until I receive feedback from users:

  • ROCm (AMD) support on Linux
  • Apple Silicon support

Testing required

I am now looking for testers to use the latest version so that I can fix bugs prior to mainlining this version of Faceswap. Be aware... there will be bugs, and I really need your help to report them, so that I can get this into a workable state.

New features

In addition to switching the backend to PyTorch, the following features have been added (amongs others):

  • More Optimizers (including LioN)
  • More configuration options for Optimizers (such as EMA, weight decay and Gradient Accumulation)
  • Vertical offset when training. This allows you to adjust the Y-offset of the face when training/converting. For example, if the target has a longer beard, you can adjust the y-offset to include more beard at the expense of forehead
  • New encoder for Phaze-A (ConvNeXt)

Installation

During testing there will be no installer for FS3, so please follow these instructions to install the FS3 beta:

Start > Anaconda prompt (for Windows. For Linux/macOS users, just open a standard Terminal)

Code: Select all

git clone https://github.com/deepfakes/faceswap.git fs3
cd fs3
git checkout fs3

conda create -n fs3 python=3.11
conda activate fs3

For Nvidia:

Code: Select all

python setup.py --installer --nvidia

For Apple Silicon:

Code: Select all

python setup.py --installer --apple-silicon

For ROCm:

Code: Select all

python setup.py --installer --rocm

Launch

Close the Terminal/Anaconda Prompt and re-open

Code: Select all

conda activate fs3
cd fs3
python faceswap.py gui

My word is final

User avatar
Barnuble
Posts: 21
Joined: Tue Jan 19, 2021 2:42 pm
Been thanked: 3 times

Re: Faceswap 3 open for testing

Post by Barnuble »

Hi everybody,

I tried to install FS3

I get this error :
WARNING Couldn't install ['"pytorch>=2.2.2,<2.4.0"', 'pytorch-cuda==12.1', '"torchaudio>=2.2.2,<2.4.0"', '"torchvision<0.19.0,>=0.17.2"'] with Conda. Please install this package manually

I tried to install it manually with the following command:
conda install pytorch torchvision torchaudio -c pytorch

...but I keep getting errors on launch... Will you create an installer ?

Thanks in advance !

User avatar
torzdf
Posts: 2752
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 141 times
Been thanked: 643 times

Re: Faceswap 3 open for testing

Post by torzdf »

Hi.

Thanks for trying to install. These are exactly the kind of errors that I am trying to iron out before mainlining the code....

You are the first person I have heard of that has hit this issue. As PyTorch is the first thing that is installed, this really shouldn't happen. Please could you provide me with the log file faceswap_setup.log from within your fs3 folder so that I can see what may have gone wrong (the file is likely to be large, so you may need to put it on pastebin).

Barnuble wrote: Sun Jun 23, 2024 2:36 pm

Will you create an installer ?

Yes, but the installer just automates the commands that you are running manually, so you are likely to hit the same issues with the installer too, unless I can remedy the issue. Either way, the installer will only come when the code is mainlined.

My word is final

User avatar
Barnuble
Posts: 21
Joined: Tue Jan 19, 2021 2:42 pm
Been thanked: 3 times

Re: Faceswap 3 open for testing

Post by Barnuble »

Hi,

Here's what i get when starting FS3 :
(I removed user name)

Setting Faceswap backend to NVIDIA
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
Traceback (most recent call last):
File "C:\Users\**\faceswap\fs3\faceswap.py", line 60, in <module>
_main()
File "C:\Users\*
\faceswap\fs3\faceswap.py", line 45, in main
generate_configs()
File "C:\Users\*
\faceswap\fs3\lib\config.py", line 650, in generate_configs
mod = import_module(f"plugins.{section}.
config")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\*
\MiniConda3\envs\fs3\Lib\importlib\__init.py", line 126, in import_module
return bootstrap.gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in gcd_import
File "<frozen importlib.
bootstrap>", line 1176, in find_and_load
File "<frozen importlib.
bootstrap>", line 1126, in find_and_load_unlocked
File "<frozen importlib.
bootstrap>", line 241, in call_with_frames_removed
File "<frozen importlib.
bootstrap>", line 1204, in gcd_import
File "<frozen importlib.
bootstrap>", line 1176, in find_and_load
File "<frozen importlib.
bootstrap>", line 1147, in find_and_load_unlocked
File "<frozen importlib.
bootstrap>", line 690, in load_unlocked
File "<frozen importlib.
bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\*
\faceswap\fs3\plugins\extract\__init.py", line 3, in <module>
from .extract_media import ExtractMedia
File "C:\Users\*
\faceswap\fs3\plugins\extract\extract_media.py", line 7, in <module>
import cv2
File "C:\Users\*
\MiniConda3\envs\fs3\Lib\site-packages\cv2\__init.py", line 181, in <module>
bootstrap()
File "C:\Users\*
\MiniConda3\envs\fs3\Lib\site-packages\cv2\__init.py", line 153, in bootstrap
native_module = importlib.import_module("cv2")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\*
***\MiniConda3\envs\fs3\Lib\importlib\__init__.py", line 126, in import_module
return bootstrap.gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: numpy._core.multiarray failed to import

Hope it can help...

User avatar
torzdf
Posts: 2752
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 141 times
Been thanked: 643 times

Re: Faceswap 3 open for testing

Post by torzdf »

Ok.I'm a bit confused here as you said you couldn't install it.

Either way, unfortunately this message doesn't tell me enough information. I would need the crash report in the faceswap folder as well as (assuming you are having installation issues) the faceswap_setup log.

You are welcome to PM them to me for privacy reasons.

My word is final

User avatar
landlocked
Posts: 7
Joined: Tue Jun 25, 2024 10:47 pm
Been thanked: 1 time

Re: Faceswap 3 open for testing

Post by landlocked »

I thought I would upgrade to FS3 to test it out, and I have hit a snag or two.

A number of packages seem to not fully install, but, oddly, if I try to manually install them after the incomplete FS3 install, the package always ends with the "you're good to go" message.

Attached in a Zip: Install screen log, bash error when trying to execute, and the FS3 crash report.

Thanks!

Landlocked

Attachments
FS3 Log and Bash Errors.zip
(12.7 KiB) Downloaded 433 times
User avatar
hash512
Posts: 3
Joined: Mon Mar 11, 2024 9:44 am

Re: Faceswap 3 open for testing

Post by hash512 »

Hi, I tried to install FS3 and apparently the installation process went fine.
Then, executing it gave me the following error:

Code: Select all

Microsoft Windows [Version 10.0.22631.3810]
(c) Microsoft Corporation. All rights reserved.

C:\Users\username>cd C:\Users\username\faceswapV3\

C:\Users\username\faceswapV3>C:\Users\username\Miniconda3\scripts\activate.bat"

(base) C:\Users\username\faceswapV3>conda activate fs3

(fs3) C:\Users\username\faceswapV3>cd fs3

(fs3) C:\Users\username\faceswapV3\fs3>python faceswap.py gui
Setting Faceswap backend to NVIDIA
07/04/2024 12:58:31 INFO     Log level set to: INFO
07/04/2024 12:58:35 ERROR    Got Exception on main handler:
Traceback (most recent call last):
  File "C:\Users\username\faceswapV3\fs3\lib\cli\launcher.py", line 185, in execute_script
    script = self._import_script()
             ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\faceswapV3\fs3\lib\cli\launcher.py", line 64, in _import_script
    module = import_module(mod)
             ^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\MiniConda3\envs\fs3\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\username\faceswapV3\fs3\scripts\gui.py", line 9, in <module>
    from lib.gui import (TaskBar, CliOptions, CommandNotebook, ConsoleOut, DisplayNotebook,
  File "C:\Users\username\faceswapV3\fs3\lib\gui\__init__.py", line 4, in <module>
    from lib.gui.command import CommandNotebook
  File "C:\Users\username\faceswapV3\fs3\lib\gui\command.py", line 9, in <module>
    from .control_helper import ControlPanel
  File "C:\Users\username\faceswapV3\fs3\lib\gui\control_helper.py", line 15, in <module>
    from .custom_widgets import ContextMenu, MultiOption, ToggledFrame, Tooltip
  File "C:\Users\username\faceswapV3\fs3\lib\gui\custom_widgets.py", line 14, in <module>
    from .utils import get_config
  File "C:\Users\username\faceswapV3\fs3\lib\gui\utils\__init__.py", line 4, in <module>
    from .config import get_config, initialize_config, PATHCACHE
  File "C:\Users\username\faceswapV3\fs3\lib\gui\utils\config.py", line 12, in <module>
    from lib.gui._config import Config as UserConfig
  File "C:\Users\username\faceswapV3\fs3\lib\gui\_config.py", line 8, in <module>
    from matplotlib import font_manager
  File "C:\Users\username\MiniConda3\envs\fs3\Lib\site-packages\matplotlib\__init__.py", line 161, in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
  File "C:\Users\username\MiniConda3\envs\fs3\Lib\site-packages\matplotlib\rcsetup.py", line 27, in <module>
    from matplotlib.colors import Colormap, is_color_like
  File "C:\Users\username\MiniConda3\envs\fs3\Lib\site-packages\matplotlib\colors.py", line 52, in <module>
    from PIL import Image
  File "C:\Users\username\MiniConda3\envs\fs3\Lib\site-packages\PIL\Image.py", line 88, in <module>
    from . import _imaging as core
ImportError: DLL load failed while importing _imaging: The specified module could not be found.
07/04/2024 12:58:35 CRITICAL An unexpected crash has occurred. Crash report written to 'C:\Users\username\faceswapV3\fs3\crash_report.2024.07.04.125832441395.log'. You MUST provide this file if seeking assistance. Please verify you are running the latest version of faceswap before reporting

(fs3) C:\Users\username\faceswapV3\fs3>

I'm attaching (https://we.tl/t-h0ZcmE8kjY - don't how to attach file on the forum :roll:) full logs and crash report. I'm available to further troubleshoot.

Thank you for keeping up this amazing project.

Regards,
hash512

Last edited by hash512 on Tue Jul 09, 2024 1:30 pm, edited 2 times in total.
User avatar
torzdf
Posts: 2752
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 141 times
Been thanked: 643 times

Re: Faceswap 3 open for testing

Post by torzdf »

Yes, this is a known issue under Windows...

I have pushed an installation update that I'm hoping will fix this.

Please run the following commands to clear the environment and then follow the installation instructions again. I would be keen to know if this update does remedy the issue.

Start > Anaconda prompt

Code: Select all

conda env remove -n fs3
conda clean --all -y
conda clean --all -y -f

My word is final

User avatar
torzdf
Posts: 2752
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 141 times
Been thanked: 643 times

Re: Faceswap 3 open for testing

Post by torzdf »

landlocked wrote: Tue Jul 02, 2024 4:41 am

I thought I would upgrade to FS3 to test it out, and I have hit a snag or two.

A number of packages seem to not fully install, but, oddly, if I try to manually install them after the incomplete FS3 install, the package always ends with the "you're good to go" message.

Attached in a Zip: Install screen log, bash error when trying to execute, and the FS3 crash report.

Thanks!

Landlocked

This is the same issue as above. Please follow the instructions in the previous post and let me know if it resolves your issue

My word is final

User avatar
hash512
Posts: 3
Joined: Mon Mar 11, 2024 9:44 am

Re: Faceswap 3 open for testing

Post by hash512 »

torzdf wrote: Tue Jul 09, 2024 5:56 pm

Yes, this is a known issue under Windows...

I have pushed an installation update that I'm hoping will fix this.

Please run the following commands to clear the environment and then follow the installation instructions again. I would be keen to know if this update does remedy the issue.

Start > Anaconda prompt

Code: Select all

conda env remove -n fs3
conda clean --all -y
conda clean --all -y -f

After all of this (cleanup + reinstall from git) I got the previous error again, exactly the same

User avatar
torzdf
Posts: 2752
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 141 times
Been thanked: 643 times

Re: Faceswap 3 open for testing

Post by torzdf »

I really wish Windows wasn't such a trash OS. I recommend using anything else.

This issue only impacts some Windows users and no one else. At this point I don't know what else I can do to fix it at install time as the bug does not happen to me.

In the meantime, can you please provide me with the file faceswap_setup.log from your faceswap folder. It is likely to be large, so you may need to zip it (you can PM me with it if you'd prefer). It may be useful to find out why exactly Windows is screwing up some people's install.

This should get you going, it has worked for others.

Start > Anaconda prompt

Code: Select all

conda activate fs3
pip uninstall pillow
pip install pillow
Last edited by torzdf on Tue Jul 09, 2024 11:57 pm, edited 2 times in total.

My word is final

User avatar
hash512
Posts: 3
Joined: Mon Mar 11, 2024 9:44 am

Re: Faceswap 3 open for testing

Post by hash512 »

torzdf wrote: Tue Jul 09, 2024 10:36 pm

I really wish Windows wasn't such a trash OS. I recommend using anything else.

This issue only impacts some Windows users and no one else. At this point I don't know what else I can do to fix it at install time as the bug does not happen to me.

In the meantime, can you please provide me with the file faceswap_setup.log from your faceswap folder. It is likely to be large, so you may need to zip it (you can PM me with it if you'd prefer). It may be useful to find out why exactly Windows is screwing up some people's install.

This should get you going, it has worked for others.

Start > Anaconda prompt

Code: Select all

conda activate fs3
pip uninstall pillow
pip install pillow

this fixed my fs3, thanks

User avatar
torzdf
Posts: 2752
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 141 times
Been thanked: 643 times

Re: Faceswap 3 open for testing

Post by torzdf »

Latest setup script should now handle the DLL issues for some Windows users

My word is final

User avatar
torzdf
Posts: 2752
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 141 times
Been thanked: 643 times

Re: Faceswap 3 open for testing

Post by torzdf »

@hash512 re: the following error:

Code: Select all

07/11/2024 21:16:23 MainProcess     _training                      io              _archive_model                 INFO     Archiving model folder 'C:\Users\username\Desktop\tmp\t\dp\model003_dfl-sae-df' to 'C:\Users\username\Desktop\tmp\t\dp\model003_dfl-sae-df_fs2_backup'
07/11/2024 21:16:23 MainProcess     _training                      multithreading  run                            DEBUG    Error in thread (_training): [WinError 5] Access is denied: 'C:\\Users\\username\\Desktop\\tmp\\t\\dp\\model003_dfl-sae-df' -> 'C:\\Users\\username\\Desktop\\tmp\\t\\dp\\model003_dfl-sae-df_fs2_backup'
07/11/2024 21:16:24 MainProcess     MainThread                     train           _monitor                       DEBUG    Thread error detected
07/11/2024 21:16:24 MainProcess     MainThread                     train           shutdown                       DEBUG    Sending shutdown to preview viewer
07/11/2024 21:16:24 MainProcess     MainThread                     train           _monitor                       DEBUG    Closed Monitor
07/11/2024 21:16:24 MainProcess     MainThread                     train           _end_thread                    DEBUG    Ending Training thread
07/11/2024 21:16:24 MainProcess     MainThread                     train           _end_thread                    CRITICAL Error caught! Exiting...
07/11/2024 21:16:24 MainProcess     MainThread                     multithreading  join                           DEBUG    Joining Threads: '_training'
07/11/2024 21:16:24 MainProcess     MainThread                     multithreading  join                           DEBUG    Joining Thread: '_training'
07/11/2024 21:16:24 MainProcess     MainThread                     multithreading  join                           ERROR    Caught exception in thread: '_training'
Traceback (most recent call last):
  File "C:\Users\username\faceswapV3_2\fs3\lib\cli\launcher.py", line 191, in execute_script
    process.process()
  File "C:\Users\username\faceswapV3_2\fs3\scripts\train.py", line 204, in process
    self._end_thread(thread, err)
  File "C:\Users\username\faceswapV3_2\fs3\scripts\train.py", line 244, in _end_thread
    thread.join()
  File "C:\Users\username\faceswapV3_2\fs3\lib\multithreading.py", line 224, in join
    raise thread.err[1].with_traceback(thread.err[2])
  File "C:\Users\username\faceswapV3_2\fs3\lib\multithreading.py", line 100, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\username\faceswapV3_2\fs3\scripts\train.py", line 268, in _training
    raise err
  File "C:\Users\username\faceswapV3_2\fs3\scripts\train.py", line 254, in _training
    model = self._load_model()
            ^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\faceswapV3_2\fs3\scripts\train.py", line 280, in _load_model
    model: ModelBase = PluginLoader.get_model(self._args.trainer)(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\faceswapV3_2\fs3\plugins\train\model\dlight.py", line 28, in __init__
    super().__init__(*args, **kwargs)
  File "C:\Users\username\faceswapV3_2\fs3\plugins\train\model\_base\model.py", line 90, in __init__
    self._io = IO(self, model_dir, self._is_predict, self.config["save_optimizer"])
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\faceswapV3_2\fs3\plugins\train\model\_base\io.py", line 98, in __init__
    self._update_legacy()
  File "C:\Users\username\faceswapV3_2\fs3\plugins\train\model\_base\io.py", line 153, in _update_legacy
    Legacy(old_fname)
  File "C:\Users\username\faceswapV3_2\fs3\plugins\train\model\_base\io.py", line 569, in __init__
    self._upgrade_model()
  File "C:\Users\username\faceswapV3_2\fs3\plugins\train\model\_base\io.py", line 854, in _upgrade_model
    archive_dir = self._archive_model()
                  ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\faceswapV3_2\fs3\plugins\train\model\_base\io.py", line 810, in _archive_model
    os.rename(model_dir, dst_path)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\username\\Desktop\\tmp\\t\\dp\\model003_dfl-sae-df' -> 'C:\\Users\\username\\Desktop\\tmp\\t\\dp\\model003_dfl-sae-df_fs2_backup'

I've moved this back to the main thread as I would prefer issues people may hit to have wider visibility.

I have just tested this on a Windows box and it works fine...

Code: Select all

07/12/2024 15:11:17 INFO     Upgrading model file from Faceswap 2 to Faceswap 3...
07/12/2024 15:11:19 INFO     Archiving model folder 'd:\fstest\train\fs2' to 'd:\fstest\train\fs2_fs2_backup'
07/12/2024 15:11:20 INFO     Model upgraded: 'd:\fstest\train\fs2'
07/12/2024 15:11:20 INFO     No existing state file found. Generating.
07/12/2024 15:11:26 INFO     Loaded model from disk: 'd:\fstest\train\fs2\original.keras'

I thought that the issue may have been trying to upgrade a model to fs3 when an fs2 backup already, but I have already covered this scenario off:

Code: Select all

07/12/2024 15:12:15 INFO     Upgrading model file from Faceswap 2 to Faceswap 3...
07/12/2024 15:12:17 CRITICAL Error caught! Exiting...
07/12/2024 15:12:17 ERROR    Caught exception in thread: '_training'
07/12/2024 15:12:17 ERROR    The destination archive folder 'd:\fstest\train\fs2_fs2_backup' already exists. Either delete this folder, select a different model folder, or remove the legacy model files from your model folder 'd:\fstest\train\fs2'.

So, ultimately, this issue is a permission error. Faceswap is asking Windows to copy the old folder to a new location. Windows is saying 'No'.

The best I can suggest, at this time, is to try moving your model folder to a different location. It may also be something like a virus checker locking the folder, preventing regular permissions.

Last edited by torzdf on Fri Jul 12, 2024 2:24 pm, edited 1 time in total.

My word is final

User avatar
mkjai
Posts: 1
Joined: Mon Jul 01, 2024 4:25 pm

Re: Faceswap 3 open for testing

Post by mkjai »

Fyi for AMD users. 7900xtx tested with Rocm 6.1. It works. ;)

User avatar
torzdf
Posts: 2752
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 141 times
Been thanked: 643 times

Re: Faceswap 3 open for testing

Post by torzdf »

Thank you for confirming :)

My word is final

User avatar
macktmo
Posts: 3
Joined: Mon May 08, 2023 1:01 am
Has thanked: 3 times

Re: Faceswap 3 open for testing

Post by macktmo »

I tried to do a fresh start on my macos, followed the instruction but i'm getting this now.

Code: Select all

python setup.py --installer --apple-silicon
INFO     Running without root/admin privileges
INFO     The tool provides tips for installation and installs required python packages
INFO     Setup in Darwin 23.6.0
INFO     Installed Python: 3.11.9 64bit
INFO     Running in Conda
INFO     Running in a Virtual Environment
INFO     Encoding: UTF-8
INFO     Installed pip: 24.2
INFO     Installing packaging
ERROR    Unable to install package: packaging. Process aborted

Any ideas? I also tried doing conda clean --all -y but nothing changed.

User avatar
ianstephens
Posts: 120
Joined: Sun Feb 14, 2021 7:20 pm
Has thanked: 12 times
Been thanked: 15 times

Re: Faceswap 3 open for testing

Post by ianstephens »

I'm back around for a bit now live has given me more free time.

I will install, work with, train, and test as much as I can and report back anything I find.

User avatar
ianstephens
Posts: 120
Joined: Sun Feb 14, 2021 7:20 pm
Has thanked: 12 times
Been thanked: 15 times

Re: Faceswap 3 open for testing

Post by ianstephens »

Having issues with the LR finder in FS3. We always get:

Code: Select all

09/26/2024 09:36:51 INFO     Finding optimal learning rate...


09/26/2024 09:36:59 CRITICAL Error caught! Exiting...
09/26/2024 09:36:59 ERROR    Caught exception in thread: '_training'
09/26/2024 09:37:04 ERROR    Got Exception on main handler:
Traceback (most recent call last):
  File "C:\Users\REDUCTED\fs3\lib\cli\launcher.py", line 191, in execute_script
    process.process()
  File "C:\Users\REDUCTED\fs3\scripts\train.py", line 204, in process
    self._end_thread(thread, err)
  File "C:\Users\REDUCTED\fs3\scripts\train.py", line 244, in _end_thread
    thread.join()
  File "C:\Users\REDUCTED\fs3\lib\multithreading.py", line 224, in join
    raise thread.err[1].with_traceback(thread.err[2])
  File "C:\Users\REDUCTED\fs3\lib\multithreading.py", line 100, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\REDUCTED\fs3\scripts\train.py", line 268, in _training
    raise err
  File "C:\Users\REDUCTED\fs3\scripts\train.py", line 255, in _training
    trainer = self._load_trainer(model)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\REDUCTED\fs3\scripts\train.py", line 303, in _load_trainer
    trainer: TrainerBase = base(model,
                           ^^^^^^^^^^^
  File "C:\Users\REDUCTED\fs3\plugins\train\trainer\original.py", line 10, in __init__
    super().__init__(*args, **kwargs)
  File "C:\Users\REDUCTED\fs3\plugins\train\trainer\_base.py", line 89, in __init__
    self._exit_early = self._handle_lr_finder()
                       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\REDUCTED\fs3\plugins\train\trainer\_base.py", line 164, in _handle_lr_finder
    success = lrf.find()
              ^^^^^^^^^^
  File "C:\Users\REDUCTED\fs3\lib\training\lr_finder.py", line 199, in find
    self._train()
  File "C:\Users\REDUCTED\fs3\lib\training\lr_finder.py", line 131, in _train
    if np.isnan(loss[0]):
                ~~~~^^^IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed

... The same model loads and runs fine when not using LR finder.

User avatar
ianstephens
Posts: 120
Joined: Sun Feb 14, 2021 7:20 pm
Has thanked: 12 times
Been thanked: 15 times

Re: Faceswap 3 open for testing

Post by ianstephens »

When starting a new model we get:

Code: Select all

09/26/2024 10:02:44 INFO     Loading Trainer from Original plugin...



09/26/2024 10:03:35 INFO     Saving Model...
09/26/2024 10:03:37 INFO     [Saved model] - Average total loss since last save: 0.22781
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\miniconda3\envs\fs3\Lib\tkinter\__init__.py", line 1967, in __call__
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
  File "C:\miniconda3\envs\fs3\Lib\tkinter\__init__.py", line 861, in callit
    func(*args)
  File "C:\Users\REDUCTED\fs3\lib\gui\display_graph.py", line 374, in refresh
    self._calcs = self._thread.get_result()  # Terminate the LongRunningTask object
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\REDUCTED\fs3\lib\gui\utils\misc.py", line 103, in get_result
    raise self.err[1].with_traceback(self.err[2])
  File "C:\Users\REDUCTED\fs3\lib\gui\utils\misc.py", line 72, in run
    retval = self._target(*self._args, **self._kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\REDUCTED\fs3\lib\gui\analysis\stats.py", line 586, in refresh
    self._get_raw()
  File "C:\Users\REDUCTED\fs3\lib\gui\analysis\stats.py", line 652, in _get_raw
    loss_dict = _SESSION.get_loss(self._session_id)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\REDUCTED\fs3\lib\gui\analysis\stats.py", line 190, in get_loss
    loss_dict = self._tb_logs.get_loss(session_id=session_id)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\REDUCTED\fs3\lib\gui\analysis\event_reader.py", line 681, in get_loss
    self._check_cache(idx)
  File "C:\Users\REDUCTED\fs3\lib\gui\analysis\event_reader.py", line 655, in _check_cache
    self._cache_data(session_id)
  File "C:\Users\REDUCTED\fs3\lib\gui\analysis\event_reader.py", line 639, in _cache_data
    iterator = self._training_iterator if live_data else RecordIterator(
                                                         ^^^^^^^^^^^^^^^
  File "C:\Users\REDUCTED\fs3\lib\gui\analysis\event_reader.py", line 496, in __init__
    self._log_file = open(self._file_path, "rb")  # pylint:disable=consider-using-with
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: ''
09/26/2024 10:03:41 INFO     [Preview Updated]

Exiting and resuming it doesn't appear again. It only happens on first model build/run.

Post Reply