MCPcopy Create free account
hub / github.com/tensorflow/models / _validate_params

Method _validate_params

official/core/base_trainer.py:242–273  ·  view source on GitHub ↗

r"""Validates if the configuration object passed to the Trainer. The experiment configuration should be structured as: \trainer \task \train_data \validation_data Args: config: a namedtuple, dataclass, ConfigDict, etc. check_train_data: whether to check task

(self,
                       config,
                       check_train_data=True,
                       check_validation_data=True)

Source from the content-addressed store, hash-verified

240 use_tf_while_loop=config.trainer.eval_tf_while_loop))
241
242 def _validate_params(self,
243 config,
244 check_train_data=True,
245 check_validation_data=True):
246 r"""Validates if the configuration object passed to the Trainer.
247
248 The experiment configuration should be structured as:
249 \trainer
250 \task
251 \train_data
252 \validation_data
253
254 Args:
255 config: a namedtuple, dataclass, ConfigDict, etc.
256 check_train_data: whether to check task.train_data field.
257 check_validation_data: whether to check task.validation_data field.
258 """
259 if not hasattr(config, "trainer"):
260 raise AttributeError("The trainer requires the configuration contains an"
261 " attribute `trainer`.")
262
263 if not hasattr(config, "task"):
264 raise AttributeError("The trainer requires the configuration contains an"
265 " attribute `task`.")
266
267 if check_train_data and not hasattr(config.task, "train_data"):
268 raise AttributeError("The trainer requires the configuration contains an"
269 " attribute `task.train_data`.")
270
271 if check_validation_data and not hasattr(config.task, "validation_data"):
272 raise AttributeError("The trainer requires the configuration contains an"
273 " attribute `task.validation_data`.")
274
275 @property
276 def strategy(self):

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected