|
| 1 | +Installation |
| 2 | +============ |
| 3 | + |
| 4 | +``pytorch-forecasting`` currently supports: |
| 5 | + |
| 6 | +* Python versions 3.8, 3.9, 3.10, 3.11, and 3.12. |
| 7 | +* Operating systems : Linux, macOS, and Windows |
| 8 | + |
| 9 | +Installing pytorch-forecasting |
| 10 | +------------------------------ |
| 11 | + |
| 12 | +``pytorch-forecasting`` is a library built on top of the popular deep learning framework ``pytorch`` and |
| 13 | +heavily uses the Pytorch Lightning library ``lightning`` for ease of training and multiple GPU usage. |
| 14 | + |
| 15 | +You'll need to install ``pytorch`` along or before with ``pytorch-forecasting`` in order to get a working |
| 16 | +install of this library. |
| 17 | + |
| 18 | +If you are working Windows, you can install PyTorch with |
| 19 | + |
| 20 | +.. code-block:: bash |
| 21 | +
|
| 22 | + pip install torch -f https://download.pytorch.org/whl/torch_stable.html |
| 23 | +
|
| 24 | +.. note:: |
| 25 | + It is recommended to visit the Pytorch official page https://pytorch.org/get-started/locally/#start-locally to |
| 26 | + figure out which version of ``pytorch`` best suits your machine if you are |
| 27 | + unfamiliar with the library. |
| 28 | + |
| 29 | +Otherwise, you can proceed with: |
| 30 | + |
| 31 | +.. code-block:: bash |
| 32 | +
|
| 33 | + pip install pytorch-forecasting --extra-index-url https://download.pytorch.org/whl/cpu |
| 34 | +
|
| 35 | +
|
| 36 | +Alternatively, to install the package via ``conda``: |
| 37 | + |
| 38 | +.. code-block:: bash |
| 39 | +
|
| 40 | + conda install pytorch-forecasting pytorch>=2.0.0 -c pytorch -c conda-forge |
| 41 | +
|
| 42 | +PyTorch Forecasting is now installed from the conda-forge channel while PyTorch is install from the pytorch channel. |
| 43 | + |
| 44 | +To install ``pytorch-forecasting`` with the use of the MQF2 loss (multivariate quantile loss), run: |
| 45 | + |
| 46 | +.. code-block:: bash |
| 47 | +
|
| 48 | + pip install pytorch-forecasting[mqf2] |
| 49 | +
|
| 50 | +
|
| 51 | +To install the Pytorch Lightning library, please visit their `official page <https://lightning.ai/docs/pytorch/stable/starter/installation.html>`__ or run: |
| 52 | + |
| 53 | +.. code-block:: bash |
| 54 | +
|
| 55 | + pip install lightning |
| 56 | +
|
| 57 | +
|
| 58 | +Obtaining a latest ``pytorch-forecasting`` version |
| 59 | +-------------------------------------------------- |
| 60 | + |
| 61 | +This type of installation obtains a latest static snapshot of the repository, with |
| 62 | +various features that are not published in a release. It is mainly intended for developers |
| 63 | +that wish to build or test code using a version of the repository that contains |
| 64 | +all of the latest or current updates. |
| 65 | + |
| 66 | +.. code-block:: bash |
| 67 | +
|
| 68 | + pip install git+https://github.com/sktime/pytorch-forecasting.git |
| 69 | +
|
| 70 | +
|
| 71 | +To install from a specific branch, use the following command: |
| 72 | + |
| 73 | +.. code-block:: bash |
| 74 | +
|
| 75 | + pip install git+https://github.com/sktime/pytorch-forecasting.git@<branch_name> |
| 76 | +
|
| 77 | +
|
| 78 | +Contributing to ``pytorch-forecasting`` |
| 79 | +--------------------------------------- |
| 80 | + |
| 81 | +Contributions to PyTorch Forecasting are very welcome! You do not have to be an expert in deep learning |
| 82 | +to contribute. If you find a bug - fix it! If you miss a feature - propose it! |
| 83 | + |
| 84 | +To obtain an editible version ``pytorch-forecasting`` for development or contributions, |
| 85 | +you will need to set up: |
| 86 | + |
| 87 | +* a local clone of the ``pytorch-forecasting`` repository. |
| 88 | +* a virtual environment with an editable install of ``pytorch-forecasting`` and the developer dependencies. |
| 89 | + |
| 90 | +The following steps guide you through the process: |
| 91 | + |
| 92 | +Creating a fork and cloning the repository |
| 93 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 94 | + |
| 95 | +1. Fork the `project |
| 96 | + repository <https://github.com/sktime/pytorch-forecasting>`__ by |
| 97 | + clicking on the 'Fork' button near the top right of the page. This |
| 98 | + creates a copy of the code under your GitHub user account. For more |
| 99 | + details on how to fork a repository see `this |
| 100 | + guide <https://help.github.com/articles/fork-a-repo/>`__. |
| 101 | + |
| 102 | +2. `Clone <https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository>`__ |
| 103 | + your fork of the pytorch-forecasting repo from your GitHub account to your local |
| 104 | + disk: |
| 105 | + |
| 106 | + .. code:: bash |
| 107 | +
|
| 108 | + git clone [email protected]:<username>/sktime/pytorch-forecasting.git |
| 109 | + cd pytorch-forecasting |
| 110 | +
|
| 111 | + where :code:`<username>` is your GitHub username. |
| 112 | + |
| 113 | +3. Configure and link the remote for your fork to the upstream |
| 114 | + repository: |
| 115 | + |
| 116 | + .. code:: bash |
| 117 | +
|
| 118 | + git remote -v |
| 119 | + git remote add upstream https://github.com/sktime/pytorch-forecasting.git |
| 120 | +
|
| 121 | +4. Verify the new upstream repository you've specified for your fork: |
| 122 | + |
| 123 | + .. code:: bash |
| 124 | +
|
| 125 | + git remote -v |
| 126 | + > origin https://github.com/<username>/sktime/pytorch-forecasting.git (fetch) |
| 127 | + > origin https://github.com/<username>/sktime/pytorch-forecasting.git (push) |
| 128 | + > upstream https://github.com/sktime/pytorch-forecasting.git (fetch) |
| 129 | + > upstream https://github.com/sktime/pytorch-forecasting.git (push) |
| 130 | +
|
| 131 | +Setting up an editible virtual environment |
| 132 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 133 | + |
| 134 | +1. Set up a new virtual environment. Our instructions will go through the commands to set up a ``conda`` environment which is recommended for ``pytorch-forecasting`` development. |
| 135 | +The process will be similar for ``venv`` or other virtual environment managers. |
| 136 | + |
| 137 | + .. warning:: |
| 138 | + Using ``conda`` via one of the commercial distributions such as Anaconda |
| 139 | + is in general not free for commercial use and may incur significant costs or liabilities. |
| 140 | + Consider using free distributions and channels for package management, |
| 141 | + and be aware of applicable terms and conditions. |
| 142 | + |
| 143 | +In the ``conda`` terminal: |
| 144 | + |
| 145 | +2. Navigate to your local pytorch-forecasting folder, :code:`cd pytorch-forecasting` or similar |
| 146 | + |
| 147 | +3. Create a new environment with a supported python version: :code:`conda create -n pytorch-forecasting-dev python=3.11` (or :code:`python=3.12` etc) |
| 148 | + |
| 149 | + .. warning:: |
| 150 | + If you already have an environment called ``pytorch-forecasting-dev`` from a previous attempt you will first need to remove this. |
| 151 | + |
| 152 | +4. Activate the environment: :code:`conda activate pytorch-forecasting-dev` |
| 153 | + |
| 154 | +5. Build an editable version of pytorch-forecasting. |
| 155 | +In order to install only the dev dependencies, :code:`pip install -e ".[dev]"` |
| 156 | +If you also want to install soft dependencies, install them individually, after the above, |
| 157 | +or instead use: :code:`pip install -e ".[all_extras,dev]"` to install all of them. |
| 158 | + |
| 159 | +Contribution Guidelines and Recommendations |
| 160 | +------------------------------------------- |
| 161 | + |
| 162 | +Submitting pull request best practices |
| 163 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 164 | + |
| 165 | +To ensure that maintainers and other developers are able to help your issues or |
| 166 | +review your contributions/pull requests, please read the following guidelines below. |
| 167 | + |
| 168 | +* Open issues to discuss your proposed changes before starting pull requests. |
| 169 | + This ensures that other developers or maintainers have adequete context/knowledge |
| 170 | + about your future contribution so that it can be swiftly integrated into the code base. |
| 171 | + |
| 172 | +* Adding context tags to the PR title. |
| 173 | + This will greatly help categorize different types of pull requests without having |
| 174 | + to look at the full title. Usually tags that start with either [ENH] - Enhancement: |
| 175 | + adding a feature, or improving code, [BUG] - Bugfixes, [MNT] - CI: test framework, [DOC] - |
| 176 | + Documentation: writing or improving documentation or docstrings. |
| 177 | + |
| 178 | +* Adding references to other links or pull requests. |
| 179 | + This helps to add context about previous or current issues/prs that relate to |
| 180 | + your contribution. This is done usually by including a full link or a hash tag '#1234'. |
| 181 | + |
| 182 | +Technical Design Principles |
| 183 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 184 | + |
| 185 | +When writing code for your new feature, it is recommended to follow these |
| 186 | +technical design principles to ensure compatability between the feature and the library. |
| 187 | + |
| 188 | +* Backward compatible API if possible to prevent breaking code. |
| 189 | +* Powerful abstractions to enable quick experimentation. At the same time, the abstractions should |
| 190 | + allow the user to still take full control. |
| 191 | +* Intuitive default values that do not need changing in most cases. |
| 192 | +* Focus on forecasting time-related data - specificially timeseries regression and classificiation. |
| 193 | + Contributions not directly related to this topic might not be merged. We want to keep the library as |
| 194 | + crisp as possible. |
| 195 | +* Install ``pre-commit`` and have it run on every commit that you make on your feature branches. |
| 196 | + This library requires strict coding and development best practices to ensure the highest code quality. |
| 197 | + Contributions or pull requests that do not adhere to these standards will not likely be merged until fixed. |
| 198 | + For more information on ``pre-commit`` you can visit `this page <https://www.sktime.net/en/stable/developer_guide/coding_standards.html#using-pre-commit>`__ |
| 199 | +* Always add tests and documentation to new features. |
0 commit comments