Wrong ouputs after implementing IO bindings despite both model producing same logits,past_key_states and encoder outputs. #47
Unanswered
VikasOjha666
asked this question in
Q&A
Replies: 1 comment
-
hi! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
class T5Encoder(Module):
def init(self,enc_session):
super().init()
self.enc_session=enc_session
self.main_input_name = "input_ids"
def encoder_output_shape(self,input_ids):
input_shape=input_ids.shape
batch_size=input_shape[0]
seq_len=input_shape[1]
return (batch_size,seq_len,768)](url)
def forward(self,input_ids,attention_mask,**kwargs):
io_bindings=self.enc_session.io_binding()
io_bindings.bind_input(name="input_ids",
device_type="cuda",
device_id= 0,
element_type=np.longlong,
shape=list(input_ids.shape),
buffer_ptr=input_ids.data_ptr())
class T5DecoderInit(torch.nn.Module):
def init(self, decoder_sess):
super().init()
self.decoder = decoder_sess
class T5Decoder(torch.nn.Module):
def init(self, decoder_sess):
super().init()
self.decoder = decoder_sess
Hi @Ki6an .I implemented the IO bindings version for GPU currently I am haven't binded the outputs of decoder and decoder init but planning to do it soon. Everything else stays the same as your code but I am noticing very strange behaviour that the generate function with your encoder and decoders produce correct outputs while for mine generate function is producing wrong output. I have also tried using torch.cuda.synchronise in some debugging cases to synchronise the cuda kernels but that even didn't effected. The output of my encoder,decoder,decoder init is same as yours except they are cuda tensors instead of CPU tensor.Please help.
Beta Was this translation helpful? Give feedback.
All reactions