Skip to content
New issue

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

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

Already on GitHub? # to your account

Which refinement methods with embed_mode code? #7

Open
artificialnouveau opened this issue Jul 3, 2024 · 0 comments
Open

Which refinement methods with embed_mode code? #7

artificialnouveau opened this issue Jul 3, 2024 · 0 comments

Comments

@artificialnouveau
Copy link

When I run the following code that does embed_mode 'code' with dhr or pti:

!python scripts/infer.py \
    --embed_mode code \
    --refine_mode dhr \
    --test_dataset_path test_images \
    --output_dir code_dhr \
    --save_code true \
    --auto_resume True \
    --stylegan_weights pretrained_models/stylegan2-ffhq-config-f.pt

I get this error in both cases:

/opt/conda/lib/python3.8/site-packages/torchvision/models/_utils.py:135: UserWarning: Using 'weights' as positional parameter(s) is deprecated since 0.13 and will be removed in 0.15. Please use keyword parameter(s) instead.
  warnings.warn(
/opt/conda/lib/python3.8/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and will be removed in 0.15. The current behavior is equivalent to passing `weights=AlexNet_Weights.IMAGENET1K_V1`. You can also use `weights=AlexNet_Weights.DEFAULT` to get the most up-to-date weights.
  warnings.warn(msg)
/opt/conda/lib/python3.8/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and will be removed in 0.15. The current behavior is equivalent to passing `weights=VGG16_Weights.IMAGENET1K_V1`. You can also use `weights=VGG16_Weights.DEFAULT` to get the most up-to-date weights.
  warnings.warn(msg)
  0%|                                                    | 0/10 [00:00<?, ?it/s][2024-06-28 08:49:35.575 pytorch-1-12-gpu-p-ml-g4dn-2xlarge-e695593685db2a4ad5cc5a178284:612 INFO utils.py:28] RULE_JOB_STOP_SIGNAL_FILENAME: None
/opt/conda/lib/python3.8/site-packages/smdebug-1.0.24b20230214-py3.8.egg/smdebug/profiler/system_metrics_reader.py:78: SyntaxWarning: "is not" with a literal. Did you mean "!="?
/opt/conda/lib/python3.8/site-packages/smdebug-1.0.24b20230214-py3.8.egg/smdebug/profiler/system_metrics_reader.py:78: SyntaxWarning: "is not" with a literal. Did you mean "!="?
[2024-06-28 08:49:35.947 pytorch-1-12-gpu-p-ml-g4dn-2xlarge-e695593685db2a4ad5cc5a178284:612 INFO profiler_config_parser.py:111] Unable to find config at /opt/ml/input/config/profilerconfig.json. Profiler is disabled.
  0%|                                                    | 0/10 [00:02<?, ?it/s]
Traceback (most recent call last):
  File "scripts/infer.py", line 138, in <module>
    main()
  File "scripts/infer.py", line 100, in main
    inversion.inverse(images, images_resize, img_paths)
  File "/root/rfv-models/development/trait-rating/encoding_scripts/GANInverter/./inference/two_stage_inference.py", line 41, in inverse
    emb_images, emb_codes, emb_info = self.embedding_module.inverse(images, images_resize, image_paths)
  File "/root/rfv-models/development/trait-rating/encoding_scripts/GANInverter/./inference/code_infer.py", line 36, in inverse
    code_path = os.path.join(self.code_path, f'{os.path.basename(path[:-4])}.pt')
  File "/opt/conda/lib/python3.8/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

When I run the same code but with refine_mode sam, I get the following error:
'''
Traceback (most recent call last):
File "scripts/infer.py", line 138, in
main()
File "scripts/infer.py", line 55, in main
inversion = TwoStageInference(opts)
File "/root/rfv-models/development/trait-rating/encoding_scripts/GANInverter/./inference/two_stage_inference.py", line 24, in init
self.embedding_module = CodeInference(opts)
File "/root/rfv-models/development/trait-rating/encoding_scripts/GANInverter/./inference/code_infer.py", line 31, in init
self.decoder.load_state_dict(decoder_checkpoint['g_ema'])
KeyError: 'g_ema'
'''

Am I missing a key file or do I need to change the input for 'code'?

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

No branches or pull requests

1 participant