안녕하세요
딥린이가 질문하나 드릴게요
Rnn 모델을 onnx로 내보내는 과정에서 발생하는 에러입니다
logits_flatten = binary_logits.view(-1, 2)
output = logits_flatten.float()
probabilities = nn.functional.softmax(output.div(0.8), dim=1)
current_sequence_input = torch.multinomial(probabilities. Data, 1).squeeze().unsqueeze(0).unsqueeze(1)
###여기서 에러가 발생합니다 torch.multinomial(probabilities.data ===>. Data RuntimeError: probability tensor contains either inf
, nan
or element < 0
...
my_modifier_scripted = torch.jit.script(Mrnn)
추론할때 또는 토치스크립트 코드에서 정상 동작을 합니다
단 onnx로 내보낼때 에러가 한번 생기는데 다시 한번 실행 시키면
onnx파일도 만들어집니다 하지만 문제는 계속 같은 결과만 나옵니다
그래서 아무래도 저 에러를 해결해야지만 될거 같은데 전혀 방법을 모르겠습니다
아시는 선배님이 계시면 딥린이에게 은총을 주십쇼~
감사!
==================================================
replacement=True 이렇게바꿔 보았는데요
torch. Multinomial(probabilities, 1, replacement=True)
이번에는 다음과 같은 에러가 나옵니다
RuntimeError: philox_cuda_state for an unexpected CUDA generator used during capture. In regions captured by CUDA graphs, you may only use the default CUDA RNG generator on the device that's current when capture begins. If you need a non-default (user-supplied) generator, or a generator on another device, please file an issue.
cpu만 사용하는걸로 해서 해보니 에러가 다음과 같네요
invalid multinomial distribution (encountering probability entry < 0)
ㅠ.ㅠ
...