MCPcopy Create free account
hub / github.com/google-research/language / model_fn

Function model_fn

language/orqa/predict/encode_blocks.py:58–69  ·  view source on GitHub ↗

Model function.

(features, labels, mode, params)

Source from the content-addressed store, hash-verified

56
57
58def model_fn(features, labels, mode, params):
59 """Model function."""
60 del labels, params
61 encoder_module = hub.Module(FLAGS.retriever_module_path)
62 block_emb = encoder_module(
63 inputs=dict(
64 input_ids=features["block_ids"],
65 input_mask=features["block_mask"],
66 segment_ids=features["block_segment_ids"]),
67 signature="projected")
68 predictions = dict(block_emb=block_emb)
69 return tf_estimator.tpu.TPUEstimatorSpec(mode=mode, predictions=predictions)
70
71
72def parse_examples(serialized_example):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…