You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-164
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,8 @@ Requirements:
17
17
18
18
> ℹ️ `torch::deploy` is ready for use in production environments, but is in Beta and may have some rough edges that we're continuously working on improving. We're always interested in hearing feedback and usecases that you might have. Feel free to reach out!
19
19
20
+
## The Easy Path to Installation
21
+
20
22
## Installation
21
23
22
24
### Building via Docker
@@ -183,170 +185,9 @@ cd build
183
185
./test_deploy
184
186
```
185
187
186
-
## Examples
187
-
188
-
See the [examples directory](./examples) for complete examples.
189
-
190
-
### Packaging a model `for multipy::runtime`
191
-
192
-
``multipy::runtime`` can load and run Python models that are packaged with
193
-
``torch.package``. You can learn more about ``torch.package`` in the ``torch.package``[documentation](https://pytorch.org/docs/stable/package.html#tutorials).
194
-
195
-
For now, let's create a simple model that we can load and run in ``multipy::runtime``.
196
-
197
-
```python
198
-
from torch.package import PackageExporter
199
-
import torchvision
200
-
201
-
# Instantiate some model
202
-
model = torchvision.models.resnet.resnet18()
203
-
204
-
# Package and export it.
205
-
with PackageExporter("my_package.pt") as e:
206
-
e.intern("torchvision.**")
207
-
e.extern("numpy.**")
208
-
e.extern("sys")
209
-
e.extern("PIL.*")
210
-
e.extern("typing_extensions")
211
-
e.save_pickle("model", "model.pkl", model)
212
-
```
213
-
214
-
Note that since "numpy", "sys", "PIL" were marked as "extern", `torch.package` will
215
-
look for these dependencies on the system that loads this package. They will not be packaged
216
-
with the model.
217
-
218
-
Now, there should be a file named ``my_package.pt`` in your working directory.
std::getenv("PATH_TO_EXTERN_PYTHON_PACKAGES") // Ensure to set this environment variable (e.g. /home/user/anaconda3/envs/multipy-example/lib/python3.8/site-packages)
target_link_libraries(example-app PUBLIC "-Wl,--no-as-needed -rdynamic" dl pthread util multipy c10 torch_cpu)
308
-
```
309
-
310
-
Currently, it is necessary to build ``multipy::runtime`` as a static library.
311
-
In order to correctly link to a static library, the utility ``caffe2_interface_library``
312
-
is used to appropriately set and unset ``--whole-archive`` flag.
313
-
314
-
Furthermore, the ``-rdynamic`` flag is needed when linking to the executable
315
-
to ensure that symbols are exported to the dynamic table, making them accessible
316
-
to the deploy interpreters (which are dynamically loaded).
317
-
318
-
**Updating LIBRARY_PATH and LD_LIBRARY_PATH**
319
-
320
-
In order to locate dependencies provided by PyTorch (e.g. `libshm`), we need to update the `LIBRARY_PATH` and `LD_LIBRARY_PATH` environment variables to include the path to PyTorch's C++ libraries. If you installed PyTorch using pip or conda, this path is usually in the site-packages. An example of this is provided below.
Copy file name to clipboardExpand all lines: docs/source/index.rst
+3-4
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,10 @@
3
3
``torch::deploy`` [Beta]
4
4
=====================
5
5
6
-
``torch::deploy`` is a system that allows you to load multiple python interpreters which execute PyTorch models, and run them in a single C++ process. Effectively, it allows people to multithread their pytorch models.
7
-
For more information on how torch::deploy works please see the related `arXiv paper <https://arxiv.org/pdf/2104.00254.pdf>`_. We plan to further generalize ``torch::deploy`` into a more generic system, ``multipy::runtime``,
8
-
which is more suitable for arbitrary python programs rather than just pytorch applications.
6
+
``torch::deploy`` (MultiPy for non-PyTorch use cases) is a C++ library that enables you to run eager mode PyTorch models in production without any modifications to your model to support tracing. ``torch::deploy`` provides a way to run using multiple independent Python interpreters in a single process without a shared global interpreter lock (GIL).
7
+
For more information on how ``torch::deploy`` works please see the related `arXiv paper <https://arxiv.org/pdf/2104.00254.pdf>`_.
9
8
9
+
The most up to date installation instructions for ``torch::deploy`` can be found in our `README <https://github.com/pytorch/multipy>`__.
0 commit comments