mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-10 05:20:33 +00:00
[hotfix] set return_outputs=False in examples and polish code (#5404)
* fix: simplify merge_batch * fix: use return_outputs=False to eliminate extra memory consumption * feat: add return_outputs warning * style: remove `return_outputs=False` as it is the default value
This commit is contained in:
@@ -198,8 +198,7 @@ def train_epoch(epoch: int, model: nn.Module, optimizer: Optimizer, _criterion:
|
||||
model,
|
||||
_criterion,
|
||||
optimizer,
|
||||
return_loss=True,
|
||||
return_outputs=True)
|
||||
return_loss=True)
|
||||
# Backward and optimize
|
||||
if is_pp_last_stage:
|
||||
loss = outputs['loss']
|
||||
|
@@ -271,7 +271,7 @@ However, if pipeline parallel is enabled, there are several usages different fro
|
||||
3. Do forward and backward passing through calling `Booster.execute_pipeline` method:
|
||||
```python
|
||||
outputs = booster.execute_pipeline(
|
||||
train_dataloader_iter, model, _criterion, optimizer, return_loss=True, return_outputs=True
|
||||
train_dataloader_iter, model, _criterion, optimizer, return_loss=True
|
||||
)
|
||||
```
|
||||
Backward passing has been completed by this method, so there is no need to call `loss.backward()` after executing this method.
|
||||
|
Reference in New Issue
Block a user