menyifang / DCT-Net

Official implementation of "DCT-Net: Domain-Calibrated Translation for Portrait Stylization", SIGGRAPH 2022 (TOG); Multi-style cartoonization
Apache License 2.0
762 stars 75 forks source link

KeyError: 'train' when running train_localtoon.py with style 'sd-illustration' #53

Closed mzhirko closed 1 year ago

mzhirko commented 1 year ago

I encountered an issue while running the train_localtoon.py script with the --style argument set to 'sd-illustration'. The script fails with a KeyError: 'train' error.

Steps to Reproduce:

Run the following command:  python train_localtoon.py --data_dir data/ --work_dir trained_model --style sd-illustration

Expected Behavior: I expected the script to run without any errors and initiate the training process with the specified style.

Actual Behavior: The script throws a KeyError: 'train' error when trying to override parameters from a configuration file.

Error Message:

2023-06-09 17:01:11,499 - modelscope - INFO - PyTorch version 1.13.1 Found.
2023-06-09 17:01:11,500 - modelscope - INFO - Loading ast index from /home/maria/.cache/modelscope/ast_indexer
2023-06-09 17:01:11,527 - modelscope - INFO - Loading done! Current index file version is 1.6.0, with md5 89c1d738fa1d696fcdec263efd734b9b and a total number of 848 components indexed
WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.

2023-06-09 17:02:19,442 - modelscope - INFO - Model is updated from modelscope hub, you can verify from https://www.modelscope.cn.
WARNING:tensorflow:From /home/maria/projects/DCT/DCT-working/venv37/lib/python3.7/site-packages/modelscope/trainers/cv/cartoon_translation_trainer.py:54: The name tf.reset_default_graph is deprecated. Please use tf.compat.v1.reset_default_graph instead.

Traceback (most recent call last):
  File "train_localtoon.py", line 36, in <module>
    main(args)
  File "train_localtoon.py", line 25, in main
    max_steps=max_steps)
  File "/home/maria/projects/DCT/DCT-working/venv37/lib/python3.7/site-packages/modelscope/trainers/cv/cartoon_translation_trainer.py", line 64, in __init__
    self._override_params_from_file()
  File "/home/maria/projects/DCT/DCT-working/venv37/lib/python3.7/site-packages/modelscope/trainers/cv/cartoon_translation_trainer.py", line 133, in _override_params_from_file
    self.params['photo'] = self.cfg['train']['photo']
  File "/home/maria/projects/DCT/DCT-working/venv37/lib/python3.7/site-packages/modelscope/utils/config.py", line 299, in __getitem__
    return self._cfg_dict.__getitem__(name)
  File "/home/maria/projects/DCT/DCT-working/venv37/lib/python3.7/site-packages/modelscope/utils/config.py", line 43, in __missing__
    raise KeyError(name)
KeyError: 'train'

Additional Information:

PyTorch version: 1.13.1
TensorFlow version: 1.15

Please let me know if you need any further information to address this issue. Thank you for your support!

mzhirko commented 1 year ago

resolved by editing configuration.json in damo/cv_unet_person-image-cartoon-sd-illustration_compound-models

SaadAhmad376 commented 1 year ago

@mzhirko what do we need to edit in the configuration file?