Skip to content

Commit

Permalink
add documentation for invoking mirdata as a script
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansjs committed Dec 11, 2024
1 parent c85321b commit 1ae90b9
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 6 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ orchset.validate() # validate that all the expected files are there
example_track = orchset.choice_track() # choose a random example track
print(example_track) # see the available data
```

Or using the CLI:
```bash
python -m mirdata orchset # download and validate the dataset
```

See the [documentation](https://mirdata.readthedocs.io/) for more examples and the API reference.


Expand Down
72 changes: 66 additions & 6 deletions docs/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,81 @@ Installation

To install Mirdata:

.. code-block:: console
.. code-block:: console
pip install mirdata
pip install mirdata
We recommend to do this inside a conda or virtual environment for reproducibility.

Command-Line Interface
----------------------

To get started with mirdata, execute the following in your console:

.. code-block:: console
python -m mirdata --help
Print a list of all available dataset loaders by calling:

.. code-block:: console
python -m mirdata --list
python -m mirdata -l
python -m mirdate # If you don't specify a dataset, it defaults to listing datasets
Download one or more datasets by specifying their name as arguments

.. code-block:: console
python -m mirdata orchset maestro
You can specify which version of a dataset you'd like to download with `--version`

.. code-block:: console
python -m mirdata maestro --version=2.0.0
python -m mirdata maestro -v 2.0.0
mirdata will choose a default location for all MIR datasets. If you'd like to redirect the download destination, you
can do the following

.. code-block:: console
python -m mirdata maestro --output /opt/data/mir/maestro
By default mirdata will validate any downloaded dataset(s). If you want to skip validation you can use `--no-validate`

.. code-block:: console
python -m mirdata maestro --no-validate
Or you can print just citations or licenses with `--citation` and `--license`.

.. code-block:: console
python -m mirdata maestro --citation --license
python -m mirdata maestro -c -L #equivalent to above
When you ask for either a license or a citation, mirdata will not download/validate the dataset. If you want to
download _and_ print a license or citation, you can add the --download flag

.. code-block:: console
python -m mirdata maestro --citation --download
python -m mirdata maestro -cd
Initializing a dataset
^^^^^^^^^^^^^^^^^^^^^^

Mirdata is easily imported into your Python code by:

.. code-block:: python
import mirdata
Initializing a dataset
^^^^^^^^^^^^^^^^^^^^^^
Print a list of all available dataset loaders by calling:

Expand All @@ -37,7 +97,7 @@ To use a loader, (for example, ``orchset`) you need to initialize it by calling:
.. code-block:: python
import mirdata
orchset = mirdata.initialize('orchset', data_home='/choose/where/data/live')
orchset = mirdata.initialize('orchset', data_home='/choose/where/data/lives')
Now ``orchset`` is a ``Dataset`` object containing common methods, described below.

Expand All @@ -50,7 +110,7 @@ Use ``version`` parameter if you wish to use a version other than the default on
.. code-block:: python
import mirdata
dataset = mirdata.initialize('orchset', data_home='/choose/where/data/live', version="1.0")
dataset = mirdata.initialize('orchset', data_home='/choose/where/data/lives', version="1.0")
Downloading a dataset
Expand Down

0 comments on commit 1ae90b9

Please sign in to comment.