Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
fix docs (#58)
Browse files Browse the repository at this point in the history
* fix links

* test

* setup
  • Loading branch information
Borda committed Feb 2, 2021
1 parent 27f765d commit c6725fe
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 18 deletions.
8 changes: 8 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,11 @@ def _package_list_from_file(pfile):
MOCK_PACKAGES = [PACKAGE_MAPPING.get(pkg, pkg) for pkg in MOCK_PACKAGES]

autodoc_mock_imports = MOCK_PACKAGES

# only run doctests marked with a ".. doctest::" directive
doctest_test_doctest_blocks = ''
doctest_global_setup = """
import torch
import pytorch_lightning as pl
import flash
"""
6 changes: 3 additions & 3 deletions docs/source/custom_task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tutorial: Creating a Custom Task
In this tutorial we will go over the process of creating a custom task,
along with a custom data module.

.. code:: python
.. testcode:: python

import flash

Expand All @@ -21,7 +21,7 @@ Here we create a basic linear regression task by subclassing
``flash.Task``. For the majority of tasks, you will likely only need to
override the ``__init__`` and ``forward`` methods.

.. code:: python
.. testcode::

class LinearRegression(flash.Task):
def __init__(self, num_inputs, learning_rate=0.001, metrics=None):
Expand Down Expand Up @@ -67,7 +67,7 @@ for the prediction of diabetes disease progression. We can create this
``DataModule`` below, wrapping the scikit-learn `Diabetes
dataset <https://scikit-learn.org/stable/datasets/toy_dataset.html#diabetes-dataset>`__.

.. code:: python
.. testcode::

class DiabetesPipeline(flash.core.data.TaskDataPipeline):
def after_uncollate(self, samples):
Expand Down
6 changes: 2 additions & 4 deletions docs/source/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ Flash is tested on Python 3.6+, and PyTorch 1.6
## Install with pip/conda

```bash
pip install lightning-flash
pip install lightning-flash -U
```

## Install from source

``` bash
git clone https://github.com/PyTorchLightning/flash.git
cd flash
pip install -e .
pip install git+https://github.com/PyTorchLightning/lightning-flash.git
```
6 changes: 4 additions & 2 deletions docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ organized PyTorch with the unecessary engineering details abstracted away.

When you need more flexibility you can build your own tasks or simply use Lightning directly.

.. note:: Read :doc:`here <reference/flash_to_pl>` to understand when to use Flash vs Lightning.
.. tip::

Read :doc:`here <reference/flash_to_pl>` to understand when to use Flash vs Lightning.

----

Expand All @@ -56,7 +58,7 @@ You can install flash using pip or conda:

.. code-block:: bash
pip install pytorch-lightning-flash -U -pre
pip install pytorch-lightning-flash -U
------

Expand Down
4 changes: 3 additions & 1 deletion docs/source/reference/image_classification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ Changing the backbone
*********************
By default, we use a `ResNet-18 <https://arxiv.org/abs/1512.03385>`_ for image classification. You can change the model run by the task by passing in a different backbone.

.. note:: When changing the backbone, make sure you pass in the same backbone to the Task and the Data object!
.. note::

When changing the backbone, make sure you pass in the same backbone to the Task and the Data object!

.. code-block:: python
Expand Down
10 changes: 5 additions & 5 deletions docs/source/reference/image_embedder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ Or on a random image tensor

.. code-block:: python
# 2. Perform inference on an image file
import torch
images = torch.rand(32, 3, 224, 224)
embeddings = model.predict(images)
print(predictions)
# 2. Perform inference on an image file
import torch
images = torch.rand(32, 3, 224, 224)
embeddings = model.predict(images)
print(predictions)
For more advanced inference options, see :ref:`predictions`.

Expand Down
4 changes: 1 addition & 3 deletions docs/source/reference/tabular_classification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ We can create :class:`~flash.tabular.TabularData` from csv files using the :func
* **numerical_input**- a list of the names of columns that contain numerical continuous data (floats)
* **target**- the name of the column we want to predict

.. tip:: you can pass in val_size and test_size to partition your training data into a separate validation and test set like so:


Next, we create the :class:`~flash.tabular.TabularClassifier` task, using the Data module we created.

.. code-block::
.. code-block:: python
import flash
from flash import download_data
Expand Down

0 comments on commit c6725fe

Please sign in to comment.