Skip to content

Commit

Permalink
update docs and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
leondgarse committed Jul 29, 2023
1 parent e86a78e commit e899a9a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,17 @@
```py
mm.save_weights("foo.h5")
```
- **Training with compile and fit**
```py
import torch
if torch.cuda.is_available():
_ = mm.to("cuda")
xx = torch.rand([64, *mm.input_shape[1:]])
yy = torch.functional.F.one_hot(torch.randint(0, mm.output_shape[-1], size=[64]), mm.output_shape[-1]).float()
loss = lambda y_pred, y_true: (y_true - y_pred.float()).abs().mean()
mm.compile(optimizer="AdamW", loss=loss, metrics='acc', grad_accumulate=4)
mm.fit(xx, yy, epochs=2, batch_size=4)
```
***

# Recognition Models
Expand Down

0 comments on commit e899a9a

Please sign in to comment.