Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

ml-agents train an already trained model

Discussion in 'ML-Agents' started by SirRolf, Mar 5, 2020.

  1. SirRolf

    SirRolf

    Joined:
    Mar 5, 2020
    Posts:
    2
    I might be saying something really stupid but is it possible to train an already trained model instead of starting from scratch.
    If not is it possible to increase the number of steps it takes before it stops training?
     
  2. SmartMediaNL

    SmartMediaNL

    Joined:
    Sep 29, 2016
    Posts:
    77
    I like to know this as well. p.s. I do know you can increase the training steps in the config file: trainer_config.yaml
    (or make a copy and change that)
    Then changing the setting of the corresponding name you are using like default:

    and there change:

    max_steps: 5.0e5

    to for example:

    max_steps: 8.0e5

    or if your if you have the time:
    max_steps: 5.0e7
     
  3. ascrawfo

    ascrawfo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    4
    To confirm, we currently don't support training an already trained model from step 0, but you can increase the number of steps in the trainer_config.yaml as described above!
     
    gsprite likes this.
  4. SirRolf

    SirRolf

    Joined:
    Mar 5, 2020
    Posts:
    2
    Thank you that helps out a lot. Are there any plans to implement this in the future?
     
  5. Darian4

    Darian4

    Joined:
    Nov 5, 2018
    Posts:
    3
    If you can't train a model starting from another model what is the point of that command line option:
    --load: If set, the training code loads an already trained model to initialize the neural network before training.

    I haven't try it yet but I though it did exactly that.
     
    betike likes this.
  6. ervteng_unity

    ervteng_unity

    Unity Technologies

    Joined:
    Dec 6, 2018
    Posts:
    150
    The --load is for resuming training, e.g. if you wanted to pause training and use your computer for something else.

    In principle, loading from a partially-trained model and resuming training is the same as training from an already trained model, so you're right - it does just initialize the NN from existing weights and continues training.
     
    betike likes this.
  7. ailuropoda0

    ailuropoda0

    Joined:
    Feb 26, 2020
    Posts:
    9
    betike likes this.
  8. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,549
    Pretty sure now you can use --initialize-from=MoveToGoal --run-id=MoveToGoal2 where it uses data from MoveTopGoal to build upon previous learning. But, im not sure if you need to pass the new id in each time? for example :

    run one
    --initialize-from=MoveToGoal --run-id=MoveToGoal2
    run two
    --initialize-from=MoveToGoal2 --run-id=MoveToGoal3

    or whether you just do
    --initialize-from=MoveToGoal --run-id=MoveToGoal3

    anyone know?