ms-swift icon indicating copy to clipboard operation
ms-swift copied to clipboard

TypeError: Subscripted generics cannot be used with class and instance checks

Open Hsu5918 opened this issue 1 year ago • 6 comments

hi, I installed the required environment following the steps, and then directly ran the Lora fine-tuning script for llama3-8b-instruct, but the following error occurred: Traceback (most recent call last): File "/home/ubuntu/D/swift/swift/cli/sft.py", line 5, in sft_main() File "/home/ubuntu/D/swift/swift/utils/run_utils.py", line 21, in x_main args, remaining_argv = parse_args(args_class, argv) File "/home/ubuntu/D/swift/swift/utils/utils.py", line 94, in parse_args parser = HfArgumentParser([class_type]) File "/home/ubuntu/anaconda3/envs/swift/lib/python3.9/site-packages/transformers/hf_argparser.py", line 137, in init self._add_dataclass_arguments(dtype) File "/home/ubuntu/anaconda3/envs/swift/lib/python3.9/site-packages/transformers/hf_argparser.py", line 264, in _add_dataclass_arguments self._parse_dataclass_field(parser, field) File "/home/ubuntu/anaconda3/envs/swift/lib/python3.9/site-packages/transformers/hf_argparser.py", line 172, in _parse_dataclass_field field.type.args[0] if isinstance(None, field.type.args[1]) else field.type.args[1] File "/home/ubuntu/anaconda3/envs/swift/lib/python3.9/typing.py", line 720, in instancecheck return self.subclasscheck(type(obj)) File "/home/ubuntu/anaconda3/envs/swift/lib/python3.9/typing.py", line 723, in subclasscheck raise TypeError("Subscripted generics cannot be used with" TypeError: Subscripted generics cannot be used with class and instance checks

how to fix this? thx!

Hsu5918 avatar May 19 '24 11:05 Hsu5918

same problem i meet

JamePeng avatar May 19 '24 12:05 JamePeng

Use pip install 'ms-swift[all]' -U to solve my problem

xlx777 avatar May 21 '24 02:05 xlx777

Use pip install 'ms-swift[all]' -U to solve my problem

I am new, and I am trying to fine-tune DeepSeekv1, and I have done so following your instructions, but nothing changed. How can I solve this problem? Are there any other methods I could try? Thank you!

Zhou-Weichen avatar May 21 '24 09:05 Zhou-Weichen

Use pip install 'ms-swift[all]' -U to solve my problem

I am new, and I am trying to fine-tune DeepSeekv1, and I have done so following your instructions, but nothing changed. How can I solve this problem? Are there any other methods I could try? Thank you!

The following is my solution. I hope it will be useful to you:

  1. uninstall swift pip uninstall ms-swift
  2. use pip install 'ms-swift[all]' -U to install swift

xlx777 avatar May 22 '24 01:05 xlx777

Use pip install 'ms-swift[all]' -U to solve my problem

I am new, and I am trying to fine-tune DeepSeekv1, and I have done so following your instructions, but nothing changed. How can I solve this problem? Are there any other methods I could try? Thank you!

The following is my solution. I hope it will be useful to you:

  1. uninstall swift pip uninstall ms-swift
  2. use pip install 'ms-swift[all]' -U to install swift

Thank you ! It works !!!

Zhou-Weichen avatar May 22 '24 01:05 Zhou-Weichen

Use pip install 'ms-swift[all]' -U to solve my problem

I am new, and I am trying to fine-tune DeepSeekv1, and I have done so following your instructions, but nothing changed. How can I solve this problem? Are there any other methods I could try? Thank you!

The following is my solution. I hope it will be useful to you:

  1. uninstall swift pip uninstall ms-swift
  2. use pip install 'ms-swift[all]' -U to install swift

Thank you ! It works !!!

I find that:

  1. pip uninstall ms-swift : uninstalling ms-swift-2.1.0.dev0
  2. pip install 'ms-swift[all]' -U : Successfully installed ms-swift-2.0.4 peft-0.10.0

It is possible that the problem appears on the version?

Zhou-Weichen avatar May 22 '24 01:05 Zhou-Weichen