Vanint/DatasetExpansion

About enviroment configuration

Closed this issue · 3 comments

Hi, thank you for your work. Initialize GIF_ Encountered some issues while modeling. It cannot your code run directly.
when I run the following:

model = instantiate_from_config(config.model)

I got the following error message:
/data/zhuhaowei/anaconda/anaconda3/envs/data-expand/lib/python3.10/site-packages/torchvision/transforms/transforms.py:329: UserWarning: Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum. warnings.warn( /data/zhuhaowei/anaconda/anaconda3/envs/data-expand/lib/python3.10/site-packages/pytorch_lightning/utilities/distributed.py:258: LightningDeprecationWarning: pytorch_lightning.utilities.distributed.rank_zero_onlyhas been deprecated in v1.8.1 and will be removed in v2.0.0. You can import it frompytorch_lightning.utilitiesinstead. rank_zero_deprecation( ==> Preparing dataset fgvc_aircraft Load fgvc_aircraft data finished. ==> creating model 'CLIP-VIT-B32' Model CLIP loaded. Global Step: 470000 LatentDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. Working with z of shape (1, 4, 32, 32) = 4096 dimensions. Traceback (most recent call last): File "/data/zhuhaowei/code/DatasetExpansion-main/GIF_SD/custom/dataset_expansion_stable_diffusion_CLIP_batch_optimization_final.py", line 732, in <module> main() File "/data/zhuhaowei/code/DatasetExpansion-main/GIF_SD/custom/dataset_expansion_stable_diffusion_CLIP_batch_optimization_final.py", line 555, in main GIF_model = load_model_from_config(config, f"{args.ckpt}") File "/data/zhuhaowei/code/DatasetExpansion-main/GIF_SD/custom/dataset_expansion_stable_diffusion_CLIP_batch_optimization_final.py", line 445, in load_model_from_config model = instantiate_from_config(config.model) File "/data/zhuhaowei/code/DatasetExpansion-main/GIF_SD/custom/ldm/util.py", line 85, in instantiate_from_config return get_obj_from_str(config["target"])(**config.get("params", dict())) File "/data/zhuhaowei/code/DatasetExpansion-main/GIF_SD/custom/ldm/models/diffusion/ddpm.py", line 461, in __init__ self.instantiate_cond_stage(cond_stage_config) File "/data/zhuhaowei/code/DatasetExpansion-main/GIF_SD/custom/ldm/models/diffusion/ddpm.py", line 519, in instantiate_cond_stage model = instantiate_from_config(config) File "/data/zhuhaowei/code/DatasetExpansion-main/GIF_SD/custom/ldm/util.py", line 85, in instantiate_from_config return get_obj_from_str(config["target"])(**config.get("params", dict())) File "/data/zhuhaowei/code/DatasetExpansion-main/GIF_SD/custom/ldm/modules/encoders/modules.py", line 141, in __init__ self.tokenizer = CLIPTokenizer.from_pretrained(version) File "/data/zhuhaowei/anaconda/anaconda3/envs/data-expand/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 1784, in from_pretrained return cls._from_pretrained( File "/data/zhuhaowei/anaconda/anaconda3/envs/data-expand/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 1825, in _from_pretrained init_kwargs = json.load(tokenizer_config_handle) File "/data/zhuhaowei/anaconda/anaconda3/envs/data-expand/lib/python3.10/json/__init__.py", line 293, in load return loads(fp.read(), File "/data/zhuhaowei/anaconda/anaconda3/envs/data-expand/lib/python3.10/json/__init__.py", line 346, in loads return _default_decoder.decode(s) File "/data/zhuhaowei/anaconda/anaconda3/envs/data-expand/lib/python3.10/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/data/zhuhaowei/anaconda/anaconda3/envs/data-expand/lib/python3.10/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I think there are some issues with my environment configuration. Now I am using transformers=4.19.2, torch=1.13.1, torch vision=0.14.1, and pytorch_ Lighting=1.9.0.

Can you provide a more detailed version of the environment? Thanks!

Vanint commented

Hi, thanks for your question. May I ask whether you have copied all the code folders from the ./meta/ directory to the target CIFAR directory? For example, you can do this using the command:

cp -r ./meta/* CIFAR

Thank you for your reply. I think there is a discrepancy between the pre-trained weights I have and the weights expected by the transformer library. I solved this problem by offline loading pre trained weights in a specific path.

I see. Thanks for your update.