Programming
huggingface에서 ignore_mismatched_sizes 사용할 수 없을 때
hey,brian
2022. 11. 22. 07:49
728x90
huggingface에서 pretrained model을 fine tuning하려고 할 때 아래와 같은 메시지가 출력되는 경우가 있다.
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "/path/python3.6/site-packages/transformers/modeling_utils.py", line 1179, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
TypeError: __init__() got an unexpected keyword argument 'ignore_mismatched_sizes'
pretrained의 마지막 레이어 노드 개수를 수정했을 때, 이를 받아들이지 못한다는 에러 로그인데 transformers 버젼이 낮을 경우 출력되는 에러이다.
728x90
ignore_mismatched_sizes는 transformers 버젼 4.9.0부터 사용할 수 있는 옵션으로, 위 에러 메시지를 해결하기 위해서는 transformers 버젼 4.9.0보다 높은 상위 버젼을 설치하여 사용하면 된다.
출처: https://github.com/huggingface/transformers/issues/13187
Unable to load model by ignoring size mismatch; TypeError: __init__() got an unexpected keyword argument 'ignore_mismatched_size
I want to save the pre-trained model at a local path and later again load it using from_pretrained method. I'm doing this as I want to use hugging face on server with no internet. I used follow...
github.com
반응형