We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FixedFileNumModelCheckpoint
限られた数のCheckpointをファイルに保存する callbackクラスを作成します。 上限ファイル数までcheckpointを保持し、溢れたcheckpointファイルは古いものから削除します。
AMIは非常に長い時間活動するため、学習のたびにCheckpointを作成するとディスク容量を圧迫する恐れがあります。
古いパラメータファイルを削除していくことで、ディスク容量を小さく抑える狙いがあります。
ただ、喫緊の課題ではないので実装する優先順位は低いです。
LightningのModelCheckpointクラスを継承し、改変して実装することを考えています。 https://lightning.ai/docs/pytorch/stable/api/lightning.pytorch.callbacks.ModelCheckpoint.html https://lightning.ai/docs/pytorch/stable/_modules/lightning/pytorch/callbacks/model_checkpoint.html#ModelCheckpoint
コンストラクタ__init__のキーワード引数に max_file_numを追加します。 そして、dequeを作成してそこにファイルパスを格納するようにします。
__init__
max_file_num
_save_checkpointメソッドをラップして、保存するファイルパスをクラス内部に保存します。保存する際に最大数 max_file_numに達していた場合は、一番最後のファイルパスを取り出し、ファイルをディスクから削除したのちに、クラスからも削除します。
_save_checkpoint
super()._save_checkpointを呼び出し、checkpointを保存します。
super()._save_checkpoint
The text was updated successfully, but these errors were encountered:
cehl-kurage
No branches or pull requests
概要
限られた数のCheckpointをファイルに保存する callbackクラスを作成します。
上限ファイル数までcheckpointを保持し、溢れたcheckpointファイルは古いものから削除します。
背景と目的
AMIは非常に長い時間活動するため、学習のたびにCheckpointを作成するとディスク容量を圧迫する恐れがあります。
古いパラメータファイルを削除していくことで、ディスク容量を小さく抑える狙いがあります。
ただ、喫緊の課題ではないので実装する優先順位は低いです。
提案内容
LightningのModelCheckpointクラスを継承し、改変して実装することを考えています。
https://lightning.ai/docs/pytorch/stable/api/lightning.pytorch.callbacks.ModelCheckpoint.html
https://lightning.ai/docs/pytorch/stable/_modules/lightning/pytorch/callbacks/model_checkpoint.html#ModelCheckpoint
コンストラクタ
__init__
のキーワード引数にmax_file_num
を追加します。 そして、dequeを作成してそこにファイルパスを格納するようにします。_save_checkpoint
メソッドをラップして、保存するファイルパスをクラス内部に保存します。保存する際に最大数max_file_num
に達していた場合は、一番最後のファイルパスを取り出し、ファイルをディスクから削除したのちに、クラスからも削除します。super()._save_checkpoint
を呼び出し、checkpointを保存します。タスク
参考
The text was updated successfully, but these errors were encountered: