Skip to content

'VisionTransformer' object has no attribute 'dist_token'  #1

Description

@lihao12306

When I fully follow the README file, when I run the py file, I report the following error“'VisionTransformer' object has no attribute 'dist_token' ”, how can I solve this.as follows:

Traceback (most recent call last):
File "main.py", line 102, in
main()
File "main.py", line 42, in main
model = CountingAnything(CFG)
File "/home/hao/桌面/LearningToCountAnything/models/CountingAnything.py", line 47, in init
self.backbone = ViTExtractor(vit_config)
File "/home/hao/桌面/LearningToCountAnything/models/backbone_vit.py", line 29, in init
self.create_from_base_model(
File "/home/hao/桌面/LearningToCountAnything/models/backbone_vit.py", line 47, in create_from_base_model
self.dist_token = base_model.dist_token
File "/root/anaconda3/envs/LearningToCountAnything/lib/python3.8/site-packages/torch/nn/modules/module.py", line 947, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'VisionTransformer' object has no attribute 'dist_token'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions