Saves the Trainer state, since Trainer.save_model saves only the tokenizer with the model. Under distributed environment this is done only for a process with rank 0.
(self)
| 958 | |
| 959 | # Trainer helper method |
| 960 | def save_state(self): |
| 961 | """ |
| 962 | Saves the Trainer state, since Trainer.save_model saves only the tokenizer with the model. |
| 963 | |
| 964 | Under distributed environment this is done only for a process with rank 0. |
| 965 | """ |
| 966 | if not self.is_world_process_zero(): |
| 967 | return |
| 968 | |
| 969 | path = os.path.join(self.args.output_dir, "trainer_state.json") |
| 970 | self.state.save_to_json(path) |
| 971 | |
| 972 | |
| 973 | # Trainer helper method |
nothing calls this directly
no test coverage detected