You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was using HfArgumentParser to parse SentenceTransformerTrainingArguments and met the following error:
parser = HfArgumentParser(SentenceTransformerTrainingArguments)`
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/admin/.local/lib/python3.10/site-packages/transformers/hf_argparser.py", line 137, in __init__
self._add_dataclass_arguments(dtype)
File "/home/admin/.local/lib/python3.10/site-packages/transformers/hf_argparser.py", line 264, in _add_dataclass_arguments
self._parse_dataclass_field(parser, field)
File "/home/admin/.local/lib/python3.10/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 "/opt/conda/envs/python3.10/lib/python3.10/typing.py", line 994, in __instancecheck__
return self.__subclasscheck__(type(obj))
File "/opt/conda/envs/python3.10/lib/python3.10/typing.py", line 997, in __subclasscheck__
raise TypeError("Subscripted generics cannot be used with"
TypeError: Subscripted generics cannot be used with class and instance checks
This error is due to that SentenceTransformerTrainingArguments.prompts has a type of dict[str, dict[str, str]] | dict[str, str] | str | None, while in _parse_dataclass_field, field.type.__args__[1] got a generic type of dict[str, str], and isinstance(None, dict[str, str]) caused the error. Could you fix this? thanks.
The text was updated successfully, but these errors were encountered:
I was using HfArgumentParser to parse
SentenceTransformerTrainingArguments
and met the following error:This error is due to that
SentenceTransformerTrainingArguments.prompts
has a type ofdict[str, dict[str, str]] | dict[str, str] | str | None
, while in_parse_dataclass_field
,field.type.__args__[1]
got a generic type ofdict[str, str]
, andisinstance(None, dict[str, str])
caused the error. Could you fix this? thanks.The text was updated successfully, but these errors were encountered: