Browse Source

Merge pull request #1008 from Wanglongzhi2001/master

Add a Stop_training property
tags/v0.100.5-BERT-load
Haiping GitHub 2 years ago
parent
commit
6838a51e78
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions
  1. +1
    -1
      src/TensorFlowNET.Core/Keras/Engine/IModel.cs
  2. +1
    -1
      src/TensorFlowNET.Keras/Callbacks/Earlystopping.cs
  3. +6
    -5
      src/TensorFlowNET.Keras/Engine/Model.cs

+ 1
- 1
src/TensorFlowNET.Core/Keras/Engine/IModel.cs View File

@@ -79,5 +79,5 @@ public interface IModel : ILayer


IKerasConfig get_config(); IKerasConfig get_config();


void set_stopTraining_true();
bool Stop_training { get;set; }
} }

+ 1
- 1
src/TensorFlowNET.Keras/Callbacks/Earlystopping.cs View File

@@ -95,7 +95,7 @@ public class EarlyStopping: ICallback
if (_wait >= _paitence && epoch > 0) if (_wait >= _paitence && epoch > 0)
{ {
_stopped_epoch = epoch; _stopped_epoch = epoch;
_parameters.Model.set_stopTraining_true();
_parameters.Model.Stop_training = true;
if (_restore_best_weights && _best_weights != null) if (_restore_best_weights && _best_weights != null)
{ {
if (_verbose > 0) if (_verbose > 0)


+ 6
- 5
src/TensorFlowNET.Keras/Engine/Model.cs View File

@@ -39,6 +39,12 @@ namespace Tensorflow.Keras.Engine
set => optimizer = value; set => optimizer = value;
} }


public bool Stop_training
{
get => stop_training;
set => stop_training = value;
}

public Model(ModelArgs args) public Model(ModelArgs args)
: base(args) : base(args)
{ {
@@ -145,10 +151,5 @@ namespace Tensorflow.Keras.Engine
return children; return children;
} }



void IModel.set_stopTraining_true()
{
stop_training = true;
}
} }
} }

Loading…
Cancel
Save