Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement - generate.py - documentation on how to load a local pkl file with docker #7

Open
johndpope opened this issue Feb 2, 2021 · 3 comments

Comments

@johndpope
Copy link

johndpope commented Feb 2, 2021

@click.option('--network', 'network_pkl', help='Network pickle filename', required=True) // should be false
@click.option('--local', 'local_pkl', help='Local pickle filename')

I recall some code that failed over to load file locally when a url is not specified. will dig around.

UPDATE
this isn't probably going to work so well with docker - needs instructions.
https://github.com/BartvLaatum/lsde_stylegan/blob/de75d15f80bb3d2bc8463b1487628ce4b6f57105/open_dlat.py

@nurpax
Copy link
Contributor

nurpax commented Feb 2, 2021

The —network option should already work with local pickles.

Can you show a command line where it fails and the error you get?

@johndpope
Copy link
Author

there maybe a simpler way - #8
If so - an update to readme file would be helpful.

@johndpope johndpope changed the title Enhancement - generate.py - option to load a local pkl file Enhancement - generate.py - documentation on how to load a local pkl file with docker Feb 2, 2021
@nurpax
Copy link
Contributor

nurpax commented Feb 2, 2021

I looked at your change and added a comment. I'll explain this briefly here and also comment on how I see the docker_run.sh script. TL;DR: please take a copy of docker_run.sh and make any changes you need to it. I consider it just "sample code", ie., it's part of the docs, not code.

When you pass filenames (such as --network some/path/network.pkl), the filename refers to a location in the running container. To make it a little easier to develop and try things out, docker_run.sh maps the top of the stylegan2-ada-pytorch directory as a /scratch volume in the container. So if you need a file from say $HOME/stylegan2-ada-pytorch/tmp/foo.pkl, and you run docker_run.sh in the $HOME/stylegan2-ada-pytorch directory, you could point to a network for example like this:

docker_run.sh python generate.py --network ./tmp/foo.pkl

or

docker_run.sh python generate.py --network /scratch/tmp/foo.pkl

The former ./tmp/foo.pkl relative path works because we also switch the current working directory to /scratch when running in the container.

The README doesn't really go into these details. This is definitely a part of the repo that I'd expect people to take a copy of and extend or change any way their project needs dictate.

I didn't originally want to add docker_run.sh in the repo at all, as these types of wrapper scripts tend to abstract away important details of their running environment, making things such as file paths and environment variables harder to get right. But OTOH, in the past StyleGAN2 releases, many people didn't even try to run Docker as the LOOONG docker run command line incantation scared them away and had them setup a native CUDA environment instead (and we all know what types of environment debugging problems that causes.). But the benefit of a real native environment sans Docker is that some details such as filenames are just easier to deal with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants