gyunggyung / KoGPT2-FineTuning

🔥 Korean GPT-2, KoGPT2 FineTuning cased. 한국어 가사 데이터 학습 🔥

Home Page:https://hipgyung.tistory.com/110

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

미세조정 시 오류

wanaDoctor opened this issue · comments

안녕하세요.

좋은 자료를 제공해주셔서 다양한 테스트를 진행해 볼 수 있었습니다.
정말 감사드립니다.

다름이 아니라, 미세조정 시 여러 데이터세트에 대해서 동일한 오류를 발생시키기 있어, 이렇게 문의를 드리게 되었습니다.

해당 오류는 아래와 같습니다. 혹시 이런 에러의 발생 원인을 아신다면... 가이드 부탁 드립니다.
Traceback (most recent call last):
File "main.py", line 187, in
main(args.epoch, args.save_path, args.load_path, args.samples, args.data_file_path, args.batch_size)
File "main.py", line 144, in main
outputs = model(data, labels=data)
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "/root/data/KoGPT2-FineTuning/kogpt2/model/torch_gpt2.py", line 588, in forward
inputs_embeds=inputs_embeds,
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "/root/data/KoGPT2-FineTuning/kogpt2/model/torch_gpt2.py", line 474, in forward
hidden_states, layer_past=layer_past, attention_mask=attention_mask, head_mask=head_mask[i]
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "/root/data/KoGPT2-FineTuning/kogpt2/model/torch_gpt2.py", line 227, in forward
self.ln_1(x), layer_past=layer_past, attention_mask=attention_mask, head_mask=head_mask
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "/root/data/KoGPT2-FineTuning/kogpt2/model/torch_gpt2.py", line 190, in forward
attn_outputs = self._attn(query, key, value, attention_mask, head_mask)
File "/root/data/KoGPT2-FineTuning/kogpt2/model/torch_gpt2.py", line 146, in _attn
w = w * b - 1e4 * (1 - b)
RuntimeError: The size of tensor a (1031) must match the size of tensor b (1024) at non-singleton dimension 3

안녕하세요.

이 이슈는 처리하는 input data가 1024를 넘어서 발생하는 이슈 같습니다. 한 줄에 매우 긴 내용이 들어가는걸 보입니다.

data.py 파일을 수정해주시면 해결될 것으로 보입니다.

제가 표시한 부분을 수정해서 dataset 안에 들어가는 데이터의 양을 줄여주시면 됩니다. Colab을 쓰시면 메모리양의 한계로 인해서 input size가 1000 이상인 것도 한 번에 처리가 불가능합니다!!

Screenshot_20200520-172701_Chrome

피드백이 없기 때문에 해당 이슈를 종료하겠습니다 :)