Skip to content

Will tensorflow return the best model as a result of training #48

Closed

Description

@slevental

I'm trying to understand the strategy of model evaluation implemented in TF within a container, my goal is to sage the most accurate model, not the most recent one. Is it possible via this API somehow?

Activity

  1. owen-t commented on Jan 18, 2018

    @owen-t
    Contributor

    The TensorFlow container saves the most recent exported model. We provide TensorFlow checkpoints, which contain older models checkpoints produced during training.

  2. slevental commented on Jan 18, 2018

    @slevental
    Author

    @owen-t so, right now I should manually evaluate all checkpoints, find the best one and create SageMaker model + endpoint based on that. That's something that makes sense to do in the SageMaker library, what do you think?

  3. owen-t commented on Jan 18, 2018

    @owen-t
    Contributor

    Agreed - allowing better control over model export in TensorFlow would be useful.

  4. chinazm commented on Jul 16, 2018

    @chinazm

    Using training hooks and evaluation hooks can do both best model saving and early stopping.

    EstimatorSpec(
    mode=spec.mode,
    predictions=spec.predictions,
    loss=spec.loss,
    train_op=spec.train_op,
    eval_metric_ops=spec.eval_metric_ops,
    export_outputs=spec.export_outputs,
    training_chief_hooks=spec.training_chief_hooks,
    training_hooks=training_hooks,
    scaffold=spec.scaffold,
    evaluation_hooks=evaluation_hooks)

  5. khu834 commented on Sep 12, 2018

    @khu834

    Using training hooks and evaluation hooks can do both best model saving and early stopping.

    EstimatorSpec(
    mode=spec.mode,
    predictions=spec.predictions,
    loss=spec.loss,
    train_op=spec.train_op,
    eval_metric_ops=spec.eval_metric_ops,
    export_outputs=spec.export_outputs,
    training_chief_hooks=spec.training_chief_hooks,
    training_hooks=training_hooks,
    scaffold=spec.scaffold,
    evaluation_hooks=evaluation_hooks)

    Do you have more specific examples or links that better demonstrate how to utilize training and evaluation hooks? e,g., how would one construct a tf.train.SessionRunHook that can read the evaluation metrics from inside model_fn over many iterations and compare the loss

    I assume the EstimatorSpec is returned by model_fn?
    Where is the 'spec' object here coming from?
    Thank you.

  6. chinazm commented on Sep 18, 2018

    @chinazm

    I would refer to this feature request:
    aws/sagemaker-tensorflow-training-toolkit#75

  7. added a commit that references this issue on Nov 15, 2018
  8. laurenyu commented on Dec 20, 2018

    @laurenyu
    Contributor

    Closing due to inactivity and the introduction of script mode with our TensorFlow containers. Script mode allows for greater flexibility in writing the TF training script, which should allow for using the hooks described above. For more information about script mode, see our TF README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions