Comments (12)
Your approach might solve the issue with the scheduler, which is how I identified the issue. However, the training still goes for longer than expected. For example, I do Trainer(..., autoresume=True).fit(..., duration="10ep")
, the training crashes after 3 epochs, then after a restart the fit
goes for an en extra 10 epochs. Here, the training lasts for 13 epochs effectively. The more interruptions or the closer they are to end the worse it gets.
from composer.
Yep... good point. I think it might also break on multiple resumptions. I will add a PR to at least require max_duration on init.
from composer.
I've added enforcements for the above restrictions. We will look at enabling autoresume + multiple fits, but its lower prioirty.
from composer.
What Mihir wrote seems reasonable to count the number of fit calls, then you just need to do some of your own timekeeping I believe.
from composer.
@antoinebrl what if you set t_max
to 1dur
? This would ensure t_max = max_duration
always on resumption.
from composer.
Awesome! Thanks for tackling it 💪
For a quick solution on my side I added couple of exceptions with instructions to guide the users towards the right path:
- in the
__init__
, whenautoresume==True
butmax_duration==None
- in the
.fit
, ifautoresume
wasTrue
andduration != None
- in the
.fit
, if the method is called multiple times whenautoresume==True
from composer.
Thanks for your reactivity on this one 💪
from composer.
Reopening as we need to revert the guardrails. It seems that there is a scenario in which this does work, where the user was tracking the number of fit calls in a callback state_dict and skipping over already completed fit calls + not ever checkpointing inside a fit call.
i'll do a more careful follow-on after release goes out
from composer.
Ok, unfortunately, we cannot impose these restrictions in Composer because it breaks a few existing workflows. Here is a rough scenario.
You want to train a model on a series of 5 datasets in a row. You only checkpoint at FIT_END
. In your code, when autoresume is set, you skip any fit calls already completed (say using a callback which tracks how many FIT_END
events have passed). If we add the checks above, this use case fails without an easy solution.
Given this, I think we will unfortunately have to currently leave it as is.
The longer term solution is for state
to track how many fit calls have been passed and, on resumption, skip completed fit calls gracefully. This is lower priority for us at this time (we would welcome community PRs!) but we will eventually add it
from composer.
I see, thanks for the precisions. Would you mind sharing this callback?
from composer.
I see, thanks for the precisions. Would you mind sharing this callback?
it would be roughly:
class FitCounter(Callback):
def __init__(self):
self.fit_count = 0
def fit_end(self, state, logger):
self.fit_count += 1
def state_dict(self):
return {'fit_count': self.fit_count}
def load_state_dict(self, state_dict):
self.fit_count = state_dict['fit_count']
and then fit
calls would be wrapped by if self.fit_count < X
. @bcui19 can elaborate
from composer.
Thanks! I was trying to come up with a way for the callback to spike the training from within.
from composer.
Related Issues (20)
- Safer Checkpoint File Format HOT 1
- Streaming Dataloader with Multiple Workers causes out-of-memory error
- LookSAM Optimizer HOT 3
- Remove logic that pops labels from batch in composer/models/huggingface.py
- Composer default lr scheduler create spurious warnings when max training duration is in epochs HOT 2
- Error when using `Trainer.compile_config={}` in DDP mode HOT 4
- Enable control over MLFlowLogger run_name str to match a pre-existing tag run_name in MLFlow and resume model training HOT 1
- TORCH_NCCL_ASYNC_ERROR_HANDLING vs NCCL_ASYNC_ERROR_HANDLING at launcher.py HOT 3
- NUMA affinity control HOT 2
- Optional `CheckpointSaver` instantiation inside the `Trainer` HOT 9
- TypeError: Subscripted generics cannot be used with class and instance checks HOT 2
- CUDA OOM error not caught with auto microbatching HOT 3
- Computing train metrics at a given frequency HOT 1
- Support DDP with rank-dependent dataloader lengths HOT 2
- Training stops after first pass of Evaluation when pretraining MosaicBert HOT 8
- EVAL_STANDALONE_END documentation missing HOT 1
- Epoch length incorrectly calculated when using DDP HOT 5
- Resuming Training from Load Path HOT 1
- ONNX export with `dynamic_axes` does not work when applying `BlurPool` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from composer.