Files
doc-exports/docs/modelarts/umn/modelarts_05_0091.html
Lai, Weijian 6aa966a79a ModelArts UMN 24.3.0 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lai, Weijian <laiweijian4@huawei.com>
Co-committed-by: Lai, Weijian <laiweijian4@huawei.com>
2024-11-02 09:04:52 +00:00

2.4 KiB

How Do I Load Some Well Trained Parameters During Job Training?

During job training, some parameters need to be loaded from a pre-trained model to initialize the current model. You can use the following methods to load the parameters:

  1. View all parameters by using the following code.
    from moxing.tensorflow.utils.hyper_param_flags import mox_flags
    print(mox_flags.get_help())
  2. Specify the parameters to be restored during model loading. checkpoint_include_patterns is the parameter that needs to be restored, and checkpoint_exclude_patterns is the parameter that does not need to be restored.
    checkpoint_include_patterns: Variables names patterns to include when restoring checkpoint. Such as: conv2d/weights.
    checkpoint_exclude_patterns: Variables names patterns to include when restoring checkpoint. Such as: conv2d/weights.
  3. Specify a list of parameters to be trained. trainable_include_patterns is a list of parameters that need to be trained, and trainable_exclude_patterns is a list of parameters that do not need to be trained.
    --trainable_exclude_patterns: Variables names patterns to exclude for trainable variables. Such as: conv1,conv2.
    --trainable_include_patterns: Variables names patterns to include for trainable variables. Such as: logits.