PDillis / stylegan3-fun

Modifications of the official PyTorch implementation of StyleGAN3. Let's easily generate images and videos with StyleGAN2/2-ADA/3!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"FileExistsError: [WinError 183] Cannot create a file when that file already exists" when resuming training

nicolai256 opened this issue · comments

Describe the bug
my guess is that it tries to create the resume outdir twice because when I run the code it does create the outdir in the map but then gives the error below because it probably can't override it or something like that.
i also tried to leave outdir empty ad your code creates the outdir automatically but it gives the same error.

Expected behavior
only create the outdir once so it doesn't create the error

Screenshots

Output directory:    C:\deepdream-test\stylegan3-fun\training-runs\00027-stylegan3-t-datasets-gpus1-batch8-gamma6.6-resume_custom
Number of GPUs:      1
Batch size:          8 images
Training duration:   25000 kimg
Dataset path:        C:\deepdream-test\stylegan3-fun\dataset22\datasets.zip
Dataset size:        5953 images
Dataset resolution:  512
Dataset labels:      False
Dataset x-flips:     True
Dataset y-flips:     False

Creating output directory...
Traceback (most recent call last):
  File "C:\deepdream-test\stylegan3-fun\train.py", line 324, in <module>
    main()  # pylint: disable=no-value-for-parameter
  File "C:\python\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\python\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\python\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\python\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\deepdream-test\stylegan3-fun\train.py", line 317, in main
    launch_training(c=c, desc=desc, outdir=opts.outdir, dry_run=opts.dry_run)
  File "C:\deepdream-test\stylegan3-fun\train.py", line 86, in launch_training
    os.makedirs(c.run_dir)
  File "C:\python\lib\os.py", line 225, in makedirs
    mkdir(name, mode)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'C:\\deepdream-test\\stylegan3-fun\\training-runs\\00027-stylegan3-t-datasets-gpus1-batch8-gamma6.6-resume_custom'

thanks for fixing the keyerror: none and activating issues on your repo :)

I fixed it by deleting File "C:\deepdream-test\stylegan3-fun\train.py", line 86, in launch_training
os.makedirs(c.run_dir)
but got a new error, i thik it has to do with creating the environment which i'm not able to do for some reason

running conda env create -f updated_environment.yml gives this error


  environment variables:
                AMDRMPATH=C:\Program Files\AMD\RyzenMaster\
                 CIO_TEST=<not set>
  CONDA_AUTO_UPDATE_CONDA=false
               CONDA_ROOT=C:\Users\Gebruiker\anaconda3
                CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2
           CURL_CA_BUNDLE=<not set>
                 HOMEPATH=\Users\Gebruiker
      MIC_LD_LIBRARY_PATH=C:\Program Files (x86)\Common Files\Intel\Shared
                          Libraries\compiler\lib\intel64_win_mic
          NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt\
                     PATH=C:\Program Files\NVIDIA GPU Computing
                          Toolkit\CUDA\v11.2\libnvvp;C:\VulkanSDK\1.2.198.1\Bin;C:\Program
                          Files\ImageMagick-7.1.0-Q16-HDRI;C:\Program Files (x86)\VMware\VMware
                          Player\bin\;C:\Program Files (x86)\Common Files\Intel\Shared
                          Libraries\redist\intel64_win\compiler;C:\Program Files (x86)\Common Fi
                          les\Oracle\Java\javapath;C:\Users\Gebruiker\ffmpegg\ffmpeg\bin\;C:\Pro
                          gram Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C
                          :\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShe
                          ll\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\HashiCorp\Vagrant\bin;E:\anac
                          onda\Git\cmd;C:\Program Files\Transfusion.AI;C:\Program Files
                          (x86)\QuickTime\QTSystem\;C:\Program Files\NVIDIA Corporation\NVIDIA
                          NvDLISR;C:\Program Files (x86)\AOMEI\AOMEI Backupper\6.7.0;C:\Windows\
                          system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Windo
                          wsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program
                          Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin;C:\Program
                          Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\NVIDIA GPU
                          Computing Toolkit\CUDA\v11.2\bin;C:\Program Files (x86)\Microsoft
                          Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64
                          ;C:\Program Files\NVIDIA Corporation\Nsight Compute
                          2020.3.1\;C:\Program Files\PuTTY\;C:\Users\Gebruiker\anaconda3;C:\User
                          s\Gebruiker\anaconda3\scripts;C:\python\Scripts\;C:\python\;C:\Program
                          Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\com
                          piler;C:\Users\Gebruiker\AppData\Local\Microsoft\WindowsApps;C:\Progra
                          m Files (x86)\Print Conductor;C:\Users\Gebruiker\ffmpegg\ffmpeg\bin\;;
                          C:\Users\Gebruiker\AppData\Local\Programs\Microsoft VS Code\bin
             PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\Windows
                          PowerShell\v1.0\Modules
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>
              VK_SDK_PATH=C:\VulkanSDK\1.2.198.1

     active environment : None
       user config file : C:\Users\Gebruiker\.condarc
 populated config files :
          conda version : 4.12.0
    conda-build version : 3.21.8
         python version : 3.9.11.final.0
       virtual packages : __cuda=11.6=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : C:\Users\Gebruiker\anaconda3  (writable)
      conda av data dir : C:\Users\Gebruiker\anaconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\Gebruiker\anaconda3\pkgs
                          C:\Users\Gebruiker\.conda\pkgs
                          C:\Users\Gebruiker\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\Gebruiker\anaconda3\envs
                          C:\Users\Gebruiker\.conda\envs
                          C:\Users\Gebruiker\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.9.11 Windows/10 Windows/10.0.19044
          administrator : False
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?

[y/N]: y
Upload successful.

Thank you for helping to improve conda.
Opt-in to always sending reports (and not see this message again)
by running

    $ conda config --set report_errors true




Thanks, I had the os.makedirs twice, hence your first error, so removing it is the answer (I would accept a pull request if you want, otherwise I'll fix it later). Regarding the second error, I forgot to remove that file, as the updated_environment.yml was for my own usage and most likely won't be correctly built for everyone else. I have updated the environment.yml file however, see if that one is sufficient for you.

i get the same error when running the environment.yml file, is there a way to get it working without the environment file?

i get the same error when running the environment.yml file, is there a way to get it working without the environment file?

nvm it worked by installing the requirements myself, thanks for all ur help!

No problem :)

I very much suspect what you had was/is an Anaconda issue, which is why I prefer to only use miniconda. You could try miniconda, but it should run in either without errors.