deepfakes / faceswap-playground

User dedicated repo for the faceswap project
306 stars 194 forks source link

EOFError: #234

Closed Friday21 closed 5 years ago

Friday21 commented 5 years ago

when I start faceswap-gpu docker, and run trainer in anther shell, I got EOFError, my command: docker exec faceswap-gpu python /srv/faceswap.py train -A=/srv/input_A -B=/srv/input_B -m /srv/models

01/10/2019 11:15:07 INFO     Log level set to: INFO
01/10/2019 11:15:08 INFO     Model A Directory: /srv/input_A
01/10/2019 11:15:08 INFO     Model B Directory: /srv/input_B
01/10/2019 11:15:08 INFO     Training data directory: /srv/models
Using TensorFlow backend.
01/10/2019 11:15:08 INFO     Loading data, this may take a while...
01/10/2019 11:15:08 INFO     Starting. Press 'ENTER' to stop training and save model
01/10/2019 11:15:08 INFO     Loading Model from Model_Original plugin...
01/10/2019 11:15:09 INFO     loaded model weights
01/10/2019 11:15:09 INFO     Loading Trainer from Model_Original plugin...
01/10/2019 11:15:09 ERROR    Got Exception on main handler:
Traceback (most recent call last):
  File "/srv/lib/cli.py", line 90, in execute_script
    process.process()
  File "/srv/scripts/train.py", line 46, in process
    self.monitor_console()
  File "/srv/scripts/train.py", line 184, in monitor_console
    input()
EOFError: EOF when reading a line
01/10/2019 11:15:09 CRITICAL An unexpected crash has occurred. Crash report written to /notebooks/crash_report.2019.01.10.111508074579.log. Please verify you are running the latest version of faceswap before reporting

so, I fixed EOFError with change train script as follow:

   def monitor_console():
        """ Monitor the console for any input followed by enter or ctrl+c """
        # TODO: how to catch a specific key instead of Enter?
        # there isn't a good multiplatform solution:
        # https://stackoverflow.com/questions/3523174
        # TODO: Find a way to interrupt input() if the target iterations are
        # reached. At the moment, setting a target iteration and using the -p
        # flag is the only guaranteed way to exit the training loop on
        # hitting target iterations.
        logger.info("Starting. Press 'ENTER' to stop training and save model")
        try:
            input()
        except (KeyboardInterrupt, EOFError) as e:
            pass

but then I got exited without press enter, which the shell shows I did!!

$ docker exec faceswap-gpu python /srv/faceswap.py train -A=/srv/input_A -B=/srv/input_B -m /srv/models

01/10/2019 11:30:43 INFO     Log level set to: INFO
01/10/2019 11:30:44 INFO     Model A Directory: /srv/input_A
01/10/2019 11:30:44 INFO     Model B Directory: /srv/input_B
01/10/2019 11:30:44 INFO     Training data directory: /srv/models
Using TensorFlow backend.
01/10/2019 11:30:44 INFO     Loading data, this may take a while...
01/10/2019 11:30:44 INFO     Starting. Press 'ENTER' to stop training and save model
01/10/2019 11:30:44 INFO     Exit requested! The trainer will complete its current cycle, save the models and quit (it can take up a couple of seconds depending on your training speed). If you want to kill it now, press Ctrl + c
01/10/2019 11:30:44 INFO     Loading Model from Model_Original plugin...
01/10/2019 11:30:45 INFO     loaded model weights
01/10/2019 11:30:45 INFO     Loading Trainer from Model_Original plugin...
01/10/2019 11:30:54 INFO     saved model weights7354
torzdf commented 5 years ago

Unfortunately I don't use Docker. @DKingCN may be able to help

bryanlyon commented 5 years ago

It says you pressed enter to exit because you added the EOFError to the same block as the KeyboardInterrupt. This effectively makes that error act as a Ctrl-C at that exact moment. A better option would be to remove the input() and put another way to exit the app.

We recommend using anaconda instead of docker now. It's not as containerized, but actually works better in most ways.

DKingAlpha commented 5 years ago

I will look into this when i have time.

At the first glancebit looks like the basic IO problem. Did you tried to run the container and attach a shell to it ?

The basic usage for me is to run the container and detach. When necessary, attach to it to open a shell and run it like in a terminal. This method works for me.

Friday21 commented 5 years ago

@DKingCN thanks, I tried run it in the docker shell, it works!

DKingAlpha commented 5 years ago

Great