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

Function input_fn

language/orqa/models/orqa_model.py:485–499  ·  view source on GitHub ↗

An input function satisfying the tf.estimator API.

(is_train, name, params)

Source from the content-addressed store, hash-verified

483
484
485def input_fn(is_train, name, params):
486 """An input function satisfying the tf.estimator API."""
487 dataset = orqa_dataset.get_dataset(
488 data_root=params["data_root"],
489 name=name,
490 split="train" if is_train else "dev")
491 if is_train:
492 dataset = dataset.repeat()
493
494 def _extract_labels(d):
495 return d, d.pop("answers")
496
497 dataset = dataset.map(_extract_labels)
498 dataset = dataset.prefetch(10)
499 return dataset
500
501
502def get_predictor_for_model_fn(model_dir, model_function):

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…