MCPcopy Index your code
hub / github.com/OptimalScale/LMFlow / test_encode

Method test_encode

tests/models/test_hf_decoder_model.py:629–637  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

627
628
629 def test_encode(self):
630 model_name = 'gpt2'
631 model_args = ModelArguments(model_name_or_path=model_name)
632 model = HFDecoderModel(model_args)
633 self.assertEqual(model.encode(test_encode_input), test_encode_output)
634
635 batch_encode_input = [test_encode_input] * 2
636 batch_encode_output = [test_encode_output] * 2
637 self.assertEqual(model.encode(batch_encode_input)['input_ids'], batch_encode_output)
638
639
640 def test_decode(self):

Callers

nothing calls this directly

Calls 3

encodeMethod · 0.95
ModelArgumentsClass · 0.90
HFDecoderModelClass · 0.90

Tested by

no test coverage detected