Module: tfm.core.train_utils
Stay organized with collections
Save and categorize content based on your preferences.
Training utils.
Classes
class BestCheckpointExporter
: Keeps track of the best result, and saves its checkpoint.
class ExperimentParser
: Constructs the Experiment config from Flags or equivalent object.
class ParseConfigOptions
: Use this dataclass instead of FLAGS to customize parse_configuration().
Functions
cast_leaf_nested_dict(...)
: Cast the leaves of a dictionary with arbitrary depth in place.
convert_variables_to_constants_v2_as_graph(...)
: Replaces all the variables in a graph with constants of the same values.
create_optimizer(...)
: A create optimizer util to be backward compatability with new args.
create_trainer(...)
: Create trainer.
get_leaf_nested_dict(...)
: Get leaf from a dictionary with arbitrary depth with a list of keys.
maybe_create_best_ckpt_exporter(...)
: Maybe create a BestCheckpointExporter object, according to the config.
parse_configuration(...)
: Parses ExperimentConfig from flags.
read_global_step_from_checkpoint(...)
: Read global step from checkpoint, or get global step from its filename.
remove_ckpts(...)
: Remove model checkpoints, so we can restart.
save_gin_config(...)
: Serializes and saves the experiment config.
serialize_config(...)
: Serializes and saves the experiment config.
try_count_flops(...)
: Counts and returns model FLOPs.
try_count_params(...)
: Count the number of parameters if model is possible.
write_json_summary(...)
: Dump evaluation metrics to json file.
write_model_params(...)
: Writes the model parameters and shapes to a file.
write_summary(...)
: Write evaluation metrics to TF summary.
Other Members |
BEST_CHECKPOINT_NAME
|
'best_ckpt'
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-02-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-02-02 UTC."],[],[],null,["# Module: tfm.core.train_utils\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/models/blob/v2.15.0/official/core/train_utils.py) |\n\nTraining utils.\n\nClasses\n-------\n\n[`class BestCheckpointExporter`](../../tfm/core/train_utils/BestCheckpointExporter): Keeps track of the best result, and saves its checkpoint.\n\n[`class ExperimentParser`](../../tfm/core/train_utils/ExperimentParser): Constructs the Experiment config from Flags or equivalent object.\n\n[`class ParseConfigOptions`](../../tfm/core/train_utils/ParseConfigOptions): Use this dataclass instead of FLAGS to customize parse_configuration().\n\nFunctions\n---------\n\n[`cast_leaf_nested_dict(...)`](../../tfm/core/train_utils/cast_leaf_nested_dict): Cast the leaves of a dictionary with arbitrary depth in place.\n\n[`convert_variables_to_constants_v2_as_graph(...)`](../../tfm/core/train_utils/convert_variables_to_constants_v2_as_graph): Replaces all the variables in a graph with constants of the same values.\n\n[`create_optimizer(...)`](../../tfm/core/train_utils/create_optimizer): A create optimizer util to be backward compatability with new args.\n\n[`create_trainer(...)`](../../tfm/core/train_utils/create_trainer): Create trainer.\n\n[`get_leaf_nested_dict(...)`](../../tfm/core/train_utils/get_leaf_nested_dict): Get leaf from a dictionary with arbitrary depth with a list of keys.\n\n[`maybe_create_best_ckpt_exporter(...)`](../../tfm/core/train_lib/maybe_create_best_ckpt_exporter): Maybe create a BestCheckpointExporter object, according to the config.\n\n[`parse_configuration(...)`](../../tfm/core/train_utils/parse_configuration): Parses ExperimentConfig from flags.\n\n[`read_global_step_from_checkpoint(...)`](../../tfm/core/train_utils/read_global_step_from_checkpoint): Read global step from checkpoint, or get global step from its filename.\n\n[`remove_ckpts(...)`](../../tfm/core/train_utils/remove_ckpts): Remove model checkpoints, so we can restart.\n\n[`save_gin_config(...)`](../../tfm/core/train_utils/save_gin_config): Serializes and saves the experiment config.\n\n[`serialize_config(...)`](../../tfm/core/train_utils/serialize_config): Serializes and saves the experiment config.\n\n[`try_count_flops(...)`](../../tfm/core/train_utils/try_count_flops): Counts and returns model FLOPs.\n\n[`try_count_params(...)`](../../tfm/core/train_utils/try_count_params): Count the number of parameters if model is possible.\n\n[`write_json_summary(...)`](../../tfm/core/train_utils/write_json_summary): Dump evaluation metrics to json file.\n\n[`write_model_params(...)`](../../tfm/core/train_utils/write_model_params): Writes the model parameters and shapes to a file.\n\n[`write_summary(...)`](../../tfm/core/train_utils/write_summary): Write evaluation metrics to TF summary.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Other Members ------------- ||\n|----------------------|---------------|\n| BEST_CHECKPOINT_NAME | `'best_ckpt'` |\n\n\u003cbr /\u003e"]]