swift icon indicating copy to clipboard operation
swift copied to clipboard

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

Open Hsu5918 opened this issue 1 month 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