Liangqiong / ViT-FL-main

MIT License
103 stars 18 forks source link

RuntimeError: Expected hasRecord("version") to be true, but got false. #9

Open azamd7 opened 1 year ago

azamd7 commented 1 year ago

I am getting the follwoing error while trying to use your code.

`We use ViT small
Traceback (most recent call last):
  File "../ViT-FL-main-main/train_FedAVG.py", line 219, in <module>
    main()

  File "../ViT-FL-main-main/train_FedAVG.py", line 198, in main
    model = initization_configure(args)

  File "../ViT-FL-main-main/utils/start_config.py", line 101, in initization_configure
    model = vit_small_patch16_224(pretrained=args.Pretrained)

  File "../miniconda3/envs/pytorch1/lib/python3.9/site-packages/timm/models/vision_transformer.py", line 1566, in vit_small_patch16_224
    model = _create_vision_transformer('vit_small_patch16_224', pretrained=pretrained, **dict(model_args, **kwargs))

  File "../miniconda3/envs/pytorch1/lib/python3.9/site-packages/timm/models/vision_transformer.py", line 1516, in _create_vision_transformer
    return build_model_with_cfg(

  File "../miniconda3/envs/pytorch1/lib/python3.9/site-packages/timm/models/_builder.py", line 393, in build_model_with_cfg
    load_pretrained(

  File "../miniconda3/envs/pytorch1/lib/python3.9/site-packages/timm/models/_builder.py", line 175, in load_pretrained
    state_dict = load_state_dict_from_url(

  File "../miniconda3/envs/pytorch1/lib/python3.9/site-packages/torch/hub.py", line 750, in load_state_dict_from_url
    return torch.load(cached_file, map_location=map_location)

  File "../miniconda3/envs/pytorch1/lib/python3.9/site-packages/torch/serialization.py", line 797, in load
    with _open_zipfile_reader(opened_file) as opened_zipfile:

  File "../miniconda3/envs/pytorch1/lib/python3.9/site-packages/torch/serialization.py", line 283, in __init__
    super().__init__(torch._C.PyTorchFileReader(name_or_buffer))

RuntimeError: Expected hasRecord("version") to be true, but got false. `

And this seems to be because of version mismatches. I think you should have given the version of all the libraries involved. Kindly check the same. Thanks