Skip to content

Commit

Permalink
Updated doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
penguinmenac3 committed Dec 20, 2021
1 parent c6519b1 commit 6d26575
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 32 deletions.
13 changes: 6 additions & 7 deletions docs/examples/DetailedMNIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ from leanai.training.losses import SparseCrossEntropyLossFromLogits, Loss


class MyLoss(Loss):
def __init__(self, parent: Experiment):
super().__init__(parent)
def __init__(self):
super().__init__()
self.loss = SparseCrossEntropyLossFromLogits()

def forward(self, y_pred, y_true):
Expand All @@ -181,6 +181,7 @@ Example:
```python
import torch
from torch.optim import SGD
from leanai.core.config import DictLike
from leanai.core.experiment import Experiment, set_seeds


Expand All @@ -191,14 +192,14 @@ experiment = Experiment(
example_input=torch.zeros((2, 28, 28, 1), dtype=torch.float32),
)
experiment.run_training(
load_dataset=dict(
load_dataset=DictLike(
type=FashionMNISTDataset,
data_path="outputs",
),
build_loss=dict(
build_loss=DictLike(
type=MyLoss
),
build_optimizer=dict(
build_optimizer=DictLike(
type=SGD,
lr=1e-3,
),
Expand Down Expand Up @@ -227,8 +228,6 @@ LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0,1]
```

> **Note**: Unfortunately the progress bar does not work properly in jupyter notebooks.
## Wrap-Up

That is it for the tutorial. You might want to have a look at tensorboard though. Here you go.
Expand Down
15 changes: 4 additions & 11 deletions docs/examples/SimpleMNIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Example:
import torch
from torch.optim import SGD

from leanai.core.config import DictLike
from leanai.core.experiment import Experiment, set_seeds
from leanai.data.datasets import FashionMNISTDataset
from leanai.training.losses import SparseCrossEntropyLossFromLogits
Expand Down Expand Up @@ -76,14 +77,14 @@ Lastly, do not forget to specify your `batch_size` and `epochs`, which are techn
Example:
```python
experiment.run_training(
load_dataset=dict(
load_dataset=DictLike(
type=FashionMNISTDataset,
data_path="outputs",
),
build_loss=dict(
build_loss=DictLike(
type=SparseCrossEntropyLossFromLogits,
),
build_optimizer=dict(
build_optimizer=DictLike(
type=SGD,
lr=1e-3,
),
Expand Down Expand Up @@ -112,8 +113,6 @@ LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0,1]
```

> **Note**: Unfortunately the progress bar does not work properly in jupyter notebooks.
## Wrap-Up

That is it for the tutorial. You might want to have a look at tensorboard though. Here you go.
Expand All @@ -123,10 +122,4 @@ Example:
%load_ext tensorboard
%tensorboard --logdir outputs
```
Output:
```
The tensorboard extension is already loaded. To reload it, use:
%reload_ext tensorboard
```

5 changes: 0 additions & 5 deletions docs/leanai/core/experiment.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ This is required, if you execute the code from within the backup in the checkpoi
(Default: True)


---
### *def* **configure_gradient_clipping**(*self*, optimizer: Optimizer, optimizer_idx: int, gradient_clip_val: Optional[Union[int, float]] = None, gradient_clip_algorithm: Optional[str] = None)

*(no documentation found)*

---
### *def* **run_training**

Expand Down
6 changes: 6 additions & 0 deletions docs/leanai/data/dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ parser or consider using and inheriting from the SimpleDataset.

* **file_provider_iterable**: The iterable file provider providing samples to the parser.
* **parser**: The parser converting samples into a usable format.
:transformers: Transformers that are applied on the dataset to convert the format to what the model requires. (Default: [])
:test_mode: A parameter that is passed to the constructor of the transformers (Default: False).


---
Expand All @@ -187,6 +189,8 @@ parser or consider using and inheriting from the SimpleDataset.

* **file_provider_sequence**: The sequence file provider providing samples to the parser.
* **parser**: The parser converting samples into a usable format.
:transformers: Transformers that are applied on the dataset to convert the format to what the model requires. (Default: [])
:test_mode: A parameter that is passed to the constructor of the transformers (Default: False).


---
Expand Down Expand Up @@ -217,6 +221,8 @@ If that is not the case, your code may break somewhere.
* **InputType**: A definition of a named tuple that defines the input of the neural network.
* **OutputType**: A definition of a named tuple that defines the output of the neural network.
* **ignore_file_not_found**: If a file is missing return None instead of an exception. (Default: False).
:transformers: Transformers that are applied on the dataset to convert the format to what the model requires. (Default: [])
:test_mode: A parameter that is passed to the constructor of the transformers (Default: False).


---
Expand Down
8 changes: 0 additions & 8 deletions docs/leanai/training/losses/loss.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@
---
## *class* **Loss**(Module)

Create a loss.

* **parent**: The parent is required for logging. Parent must be of type Loss or Experiment.


---
### *def* **set_parent**(*self*, parent)

*(no documentation found)*

---
Expand Down
2 changes: 1 addition & 1 deletion docs/leanai/training/losses/multiloss.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Compute the multiloss using the provided losses.


---
### *def* **MultiLossV2**(parent, **losses) -> SumLoss
### *def* **MultiLossV2**(**losses) -> SumLoss

Normalizes the losses by variance estimation and then sums them.

Expand Down

0 comments on commit 6d26575

Please sign in to comment.