microsoft / GLIP

Grounded Language-Image Pre-training
MIT License
2.07k stars 186 forks source link

Required version for transformer #147

Open Nana2929 opened 9 months ago

Nana2929 commented 9 months ago

Hi, I ran into the below error:

  File "/home/nanaeilish/projects/recommender/GLIP/maskrcnn_benchmark/modeling/language_backbone/backbone.py", line 45, in build_backbone
    return registry.LANGUAGE_BACKBONES[cfg.MODEL.LANGUAGE_BACKBONE.MODEL_TYPE](cfg)
  File "/home/nanaeilish/projects/recommender/GLIP/maskrcnn_benchmark/modeling/language_backbone/backbone.py", line 14, in build_bert_backbone
    body = bert_model.BertEncoder(cfg)
  File "/home/nanaeilish/projects/recommender/GLIP/maskrcnn_benchmark/modeling/language_backbone/bert_model.py", line 20, in __init__
    self.model = BertModel.from_pretrained(self.bert_name, add_pooling_layer=False, config=config)
  File "/home/nanaeilish/micromamba/envs/glip/lib/python3.9/site-packages/transformers/modeling_utils.py", line 2895, in from_pretrained
    state_dict = load_state_dict(resolved_archive_file)
  File "/home/nanaeilish/micromamba/envs/glip/lib/python3.9/site-packages/transformers/modeling_utils.py", line 478, in load_state_dict
    return safe_load_file(checkpoint_file)
  File "/home/nanaeilish/micromamba/envs/glip/lib/python3.9/site-packages/safetensors/torch.py", line 310, in load_file
    result[k] = f.get_tensor(k)
AttributeError: module 'torch' has no attribute 'frombuffer'

And I think it is due to version mismatch between my torch and transformer package. My transformer module 4.33.2 is trying to use an attribute that torch 1.9.0 does not have. I'd like to know the exact version that you use for running this up. Thanks.

liunian-harold-li commented 8 months ago

Hi, sorry for the late response. The version we used should be 4.11.0.