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

Method to_bfloat16

examples/pytorch/bert/utils/encoder.py:216–220  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

214 self.weights[k] = v.half()
215
216 def to_bfloat16(self):
217 if self.int8:
218 raise RuntimeError("Cannot cast to bfloat16 if the weights have been casted to int8.")
219 for k, v in self.weights.items():
220 self.weights[k] = v.bfloat16()
221
222 def to_int8(self, sparse=False, ths_path='./lib/libth_transformer.so'):
223 if self._generated_weights:

Callers 4

mainFunction · 0.95
mainFunction · 0.95
bert_exampleFunction · 0.95
build_base_modelFunction · 0.95

Calls 1

bfloat16Method · 0.45

Tested by

no test coverage detected