Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't use longvit #103

Open
abebe9849 opened this issue Apr 18, 2024 · 0 comments
Open

can't use longvit #103

abebe9849 opened this issue Apr 18, 2024 · 0 comments

Comments

@abebe9849
Copy link

I create new conda env and then

pip install -r requirements.txt
pip install git+https://github.com/shumingma/fairseq.git@moe
pip install -v -U git+https://github.com/facebookresearch/[email protected]#egg=xformers

installed above.

however,I cant try using longvit

#https://github.com/microsoft/torchscale/blob/main/examples/longvit/longvit.py
#L241 add these code
model = LongViT(img_size=1024)
import torch
out = model(torch.randn((2,3,102,4,1024)))
print(out)


Traceback (most recent call last):
  File "/home/user/ABE/torchscale/examples/longvit/longvit.py", line 26, in <module>
    from torchscale.architecture.encoder import Encoder
  File "/home/user/ABE/torchscale/torchscale/architecture/encoder.py", line 21, in <module>
    from torchscale.component.xmoe.moe_layer import MOELayer
  File "/home/user/ABE/torchscale/torchscale/component/xmoe/moe_layer.py", line 24, in <module>
    from fairseq.modules.moe import MOELayer
  File "/home/user/anaconda3/envs/longvit/lib/python3.11/site-packages/fairseq/__init__.py", line 20, in <module>
    from fairseq.distributed import utils as distributed_utils
  File "/home/user/anaconda3/envs/longvit/lib/python3.11/site-packages/fairseq/distributed/__init__.py", line 7, in <module>
    from .fully_sharded_data_parallel import fsdp_enable_wrap, fsdp_wrap, FullyShardedDataParallel
  File "/home/user/anaconda3/envs/longvit/lib/python3.11/site-packages/fairseq/distributed/fully_sharded_data_parallel.py", line 13, in <module>
    from fairseq.dataclass.configs import DistributedTrainingConfig
  File "/home/user/anaconda3/envs/longvit/lib/python3.11/site-packages/fairseq/dataclass/__init__.py", line 6, in <module>
    from .configs import FairseqDataclass
  File "/home/user/anaconda3/envs/longvit/lib/python3.11/site-packages/fairseq/dataclass/configs.py", line 973, in <module>
    @dataclass
     ^^^^^^^^^
  File "/home/user/anaconda3/envs/longvit/lib/python3.11/dataclasses.py", line 1221, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/home/user/anaconda3/envs/longvit/lib/python3.11/dataclasses.py", line 1211, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/anaconda3/envs/longvit/lib/python3.11/dataclasses.py", line 959, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/anaconda3/envs/longvit/lib/python3.11/dataclasses.py", line 816, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory

what should i do next?

@abebe9849 abebe9849 changed the title can't use longvti can't use longvit Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant