MCPcopy Create free account
hub / github.com/apple/axlearn / extract_text

Function extract_text

axlearn/common/input_test_utils.py:102–103  ·  view source on GitHub ↗
(example: dict[str, tf.Tensor], input_key: str = "text")

Source from the content-addressed store, hash-verified

100
101
102def extract_text(example: dict[str, tf.Tensor], input_key: str = "text") -> str:
103 return bytes.decode(example[input_key].numpy(), "utf-8")
104
105
106def extract_text_ragged(example: dict[str, tf.Tensor], input_key: str = "text") -> list[list[str]]:

Calls 1

decodeMethod · 0.45

Tested by

no test coverage detected