MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / FTHFDebertaModel

Class FTHFDebertaModel

examples/tensorflow/deberta/utils/ft_deberta.py:175–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173
174
175class FTHFDebertaModel():
176 def __init__(self, ft_model, remove_padding=True):
177 self.model = ft_model
178 self.remove_padding = remove_padding
179
180 def __call__(self, input_ids, attention_mask, **kwargs):
181 seq_len = tf.reduce_sum(attention_mask, axis=1)
182 outputs = self.model.forward(input_ids, seq_len, remove_padding=self.remove_padding)
183
184 # to match HF structure
185 FTOutput = namedtuple("FTOutput", ["output", "hidden_states", "attentions"])
186 o = FTOutput(outputs, None, None)
187 return o

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected