Giter Site home page Giter Site logo

pytorch / multipy Goto Github PK

View Code? Open in Web Editor NEW
166.0 15.0 36.0 3.01 MB

torch::deploy (multipy for non-torch uses) is a system that lets you get around the GIL problem by running multiple Python interpreters in a single C++ process.

License: Other

Python 34.37% Shell 0.63% C 0.17% CMake 5.21% C++ 58.47% Dockerfile 1.15%

multipy's Introduction

License Runtime Tests

torch::deploy (MultiPy)

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). For more information on how torch::deploy works internally, please see the related arXiv paper.

To learn how to use torch::deploy see Installation and Examples.

Requirements:

  • PyTorch 1.13+ or PyTorch nightly
  • Linux (ELF based)
    • x86_64 (Beta)
    • arm64/aarch64 (Prototype)

ℹī¸ 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!

Installation

Building via Docker

The easiest way to build deploy and install the interpreter dependencies is to do so via docker.

git clone --recurse-submodules https://github.com/pytorch/multipy.git
cd multipy
export DOCKER_BUILDKIT=1
docker build -t multipy .

The built artifacts are located in multipy/runtime/build.

To run the tests:

docker run --rm multipy multipy/runtime/build/test_deploy

Installing via pip install

We support installing both python modules and the runtime libs using pip install, with the caveat of having to manually install the C++ dependencies first. This serves as a single-command source build, essentially being a wrapper around python setup.py develop, once all the dependencies have been installed.

To start with, the multipy repo should be cloned first:

git clone --recurse-submodules https://github.com/pytorch/multipy.git
cd multipy

# (optional) if using existing checkout
git submodule sync && git submodule update --init --recursive

Installing System Dependencies

The runtime system dependencies are specified in build-requirements-{debian,centos8}.txt. To install them on Debian-based systems, one could run:

sudo apt update
xargs sudo apt install -y -qq --no-install-recommends <build-requirements-debian.txt

While on a Centos system:

xargs sudo dnf install -y <build-requirements-centos8.txt

Python Environment Setup

We support both conda and pyenv+virtualenv to create isolated environments to build and run in. Since multipy requires a position-independent version of python to launch interpreters with, for conda environments we use the prebuilt libpython-static=3.x libraries from conda-forge to link with at build time, and for virtualenv/pyenv we compile python with -fPIC to create the linkable library.

NOTE We support Python versions 3.7 through 3.10 for multipy; note that for conda environments the libpython-static libraries are available for 3.8 onwards. With virtualenv/pyenv any version from 3.7 through 3.10 can be used, as the PIC library is built explicitly.

Click to expand

Example commands for installing conda:

curl -fsSL -v -o ~/miniconda.sh -O  https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh  && \
chmod +x ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh

Virtualenv / pyenv can be installed as follows:

pip3 install virtualenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv

Installing python, pytorch and related dependencies

Multipy requires a version of pytorch > 1.13 to run models successfully, and we recommend fetching the latest stable release (1.13) / nightlies and also cuda, if required.

In a conda environment, we would do the following or similar depending on which version of pytorch we want:
conda create -n newenv
conda activate newenv
conda install python=3.8
conda install -c conda-forge libpython-static=3.8

# cuda
conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia

# cpu only
conda install pytorch torchvision torchaudio cpuonly -c pytorch
For a pyenv / virtualenv setup, one could do:
export CFLAGS="-fPIC -g"
~/.pyenv/bin/pyenv install --force 3.8.6
virtualenv -p ~/.pyenv/versions/3.8.6/bin/python3 ~/venvs/multipy
source ~/venvs/multipy/bin/activate
pip install -r dev-requirements.txt

# cuda
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

# cpu only
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu

Running pip install

Once all the dependencies are successfully installed, most importantly including a PIC-library of python and the latest nightly of pytorch, we can run the following, in either conda or virtualenv, to install both the python modules and the runtime/interpreter libraries:

# from base multipy directory
pip install -e .

The C++ binaries should be available in /opt/dist.

Alternatively, one can install only the python modules without invoking cmake as follows:

INSTALL_PYTHON_ONLY=1 pip install  -e .

NOTE As of 10/11/2022 the linking of prebuilt static fPIC versions of python downloaded from conda-forge can be problematic on certain systems (for example Centos 8), with linker errors like libpython_multipy.a: error adding symbols: File format not recognized. This seems to be an issue with binutils, and the steps in https://wiki.gentoo.org/wiki/Project:Toolchain/Binutils_2.32_upgrade_notes/elfutils_0.175:_unable_to_initialize_decompress_status_for_section_.debug_info can help. Alternatively, the user can go with the virtualenv/pyenv flow above.

Development

Manually building multipy::runtime from source

Both docker and pip install options above are wrappers around the cmake build of multipy's runtime. For development purposes it's often helpful to invoke cmake separately.

See the install section for how to correctly setup the Python environment.

# checkout repo
git clone --recurse-submodules https://github.com/pytorch/multipy.git
cd multipy

# (optional) if using existing checkout
git submodule sync && git submodule update --init --recursive

# install python parts of `torch::deploy` in multipy/multipy/utils
INSTALL_PYTHON_ONLY=1 pip install -e .

cd multipy/runtime

# configure runtime to build/
cmake -S . -B build
# if you need to override the ABI setting you can pass
cmake -S . -B build -D_GLIBCXX_USE_CXX11_ABI=<0/1>

# compile the files in build/
cmake --build build --config Release -j

Running unit tests for multipy::runtime

We first need to generate the neccessary examples. First make sure your python environment has torch. Afterwards, once multipy::runtime is built, run the following (executed automatically for docker and pip above):

python multipy/runtime/example/generate_examples.py
./multipy/runtime/build/test_deploy

Examples

See the examples directory for complete examples.

Packaging a model for multipy::runtime

multipy::runtime can load and run Python models that are packaged with torch.package. You can learn more about torch.package in the torch.package documentation.

For now, let's create a simple model that we can load and run in multipy::runtime.

from torch.package import PackageExporter
import torchvision

# Instantiate some model
model = torchvision.models.resnet.resnet18()

# Package and export it.
with PackageExporter("my_package.pt") as e:
    e.intern("torchvision.**")
    e.extern("numpy.**")
    e.extern("sys")
    e.extern("PIL.*")
    e.extern("typing_extensions")
    e.save_pickle("model", "model.pkl", model)

Note that since "numpy", "sys", "PIL" were marked as "extern", torch.package will look for these dependencies on the system that loads this package. They will not be packaged with the model.

Now, there should be a file named my_package.pt in your working directory.


Load the model in C++

#include <multipy/runtime/deploy.h>
#include <multipy/runtime/path_environment.h>
#include <torch/script.h>
#include <torch/torch.h>

#include <iostream>
#include <memory>

int main(int argc, const char* argv[]) {
    if (argc != 2) {
        std::cerr << "usage: example-app <path-to-exported-script-module>\n";
        return -1;
    }

    // Start an interpreter manager governing 4 embedded interpreters.
    std::shared_ptr<multipy::runtime::Environment> env =
        std::make_shared<multipy::runtime::PathEnvironment>(
            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)
        );
    multipy::runtime::InterpreterManager manager(4, env);

    try {
        // Load the model from the multipy.package.
        multipy::runtime::Package package = manager.loadPackage(argv[1]);
        multipy::runtime::ReplicatedObj model = package.loadPickle("model", "model.pkl");
    } catch (const c10::Error& e) {
        std::cerr << "error loading the model\n";
        std::cerr << e.msg();
        return -1;
    }

    std::cout << "ok\n";
}

This small program introduces many of the core concepts of multipy::runtime.

An InterpreterManager abstracts over a collection of independent Python interpreters, allowing you to load balance across them when running your code.

PathEnvironment enables you to specify the location of Python packages on your system which are external, but necessary, for your model.

Using the InterpreterManager::loadPackage method, you can load a multipy.package from disk and make it available to all interpreters.

Package::loadPickle allows you to retrieve specific Python objects from the package, like the ResNet model we saved earlier.

Finally, the model itself is a ReplicatedObj. This is an abstract handle to an object that is replicated across multiple interpreters. When you interact with a ReplicatedObj (for example, by calling forward), it will select an free interpreter to execute that interaction.


Build and execute the C++ example

Assuming the above C++ program was stored in a file called, example-app.cpp, a minimal CMakeLists.txt file would look like:

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(multipy_tutorial)

set(MULTIPY_PATH ".." CACHE PATH "The repo where multipy is built or the PYTHONPATH")

# include the multipy utils to help link against
include(${MULTIPY_PATH}/multipy/runtime/utils.cmake)

# add headers from multipy
include_directories(${MULTIPY_PATH})

# link the multipy prebuilt binary
add_library(multipy_internal STATIC IMPORTED)
set_target_properties(multipy_internal
    PROPERTIES
    IMPORTED_LOCATION
    ${MULTIPY_PATH}/multipy/runtime/build/libtorch_deploy.a)
caffe2_interface_library(multipy_internal multipy)

add_executable(example-app example-app.cpp)
target_link_libraries(example-app PUBLIC "-Wl,--no-as-needed -rdynamic" dl pthread util multipy c10 torch_cpu)

Currently, it is necessary to build multipy::runtime as a static library. In order to correctly link to a static library, the utility caffe2_interface_library is used to appropriately set and unset --whole-archive flag.

Furthermore, the -rdynamic flag is needed when linking to the executable to ensure that symbols are exported to the dynamic table, making them accessible to the deploy interpreters (which are dynamically loaded).

Updating LIBRARY_PATH and LD_LIBRARY_PATH

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.

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/user/anaconda3/envs/multipy-example/lib/python3.8/site-packages/torch/lib"
export LIBRARY_PATH="$LIBRARY_PATH:/home/user/anaconda3/envs/multipy-example/lib/python3.8/site-packages/torch/lib"

The last step is configuring and building the project. Assuming that our code directory is laid out like this:

example-app/
    CMakeLists.txt
    example-app.cpp

We can now run the following commands to build the application from within the example-app/ folder:

cmake -S . -B build -DMULTIPY_PATH="/home/user/repos/multipy" # the parent directory of multipy (i.e. the git repo)
cmake --build build --config Release -j

Now we can run our app:

./example-app /path/to/my_package.pt

Contributing

We welcome PRs! See the CONTRIBUTING file.

License

MultiPy is BSD licensed, as found in the LICENSE file.

Legal

Terms of Use Privacy Policy

Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.

multipy's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

multipy's Issues

Queston: is there any examples of inferece with python models written with numpy (intead of pytorch models)?

I notice in the introduction that

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.

Also most of the examples provided are with PyTorch. Is there any examples of inferece with python-written models (intead of pytorch models)? For example, can I do inference here with xgboost or lightgbm or simple decision tree written in python with numpy?

Support GPU unit tests

Currently test_deploy_gpu found in multipy/multipy/runtime/CMakeLists.txt is not used as part of our CI. We should integrate it into our CI.

Add Multithreading tests to test_deploy.cpp

Given our multipy/runtime/examples/benchmark.cpp was broken for some time, we should make sure this does not happen again. This is a primary use case of torch::deploy therefore we should support it. We can do this by

  • Follow the build instructions on our README.md to build and test torch::deploy.
  • Add a test to test_deploy.cpp that at least uses 2 threads. An example of multithreading can be found in our benchmarks. Make sure you do not share tensors between interpreter sessions otherwise you'll run into bugs.
    [ ] These tests are primarily for OSS, so use #ifndef FBCODE_CAFFE2/#endif to make sure the tests do not run internally.
  • Rebuild and test torch::deploy
  • Create a Pull Request and press the button on the PR to import it into Phabricator.

If you get stuck anywhere feel free to reach out to Sahan Paliskara

Issue in installing the release version of multipy

Hi

I just tried installing the release version of multipy in the way suggested in here. It succeeded. However, when trying the tutorial example here, there is an error in th step make -j regarding -fPIC:

/usr/bin/ld: /home/ubuntu/forked//multipy/runtime/lib/libtorch_deploy.a(deploy.cpp.o): relocation R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/ubuntu/forked//multipy/runtime/lib/libtorch_deploy.a(loader.cpp.o): relocation R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/ubuntu/forked//multipy/runtime/lib/libtorch_deploy.a(path_environment.cpp.o): relocation R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/ubuntu/forked//multipy/runtime/lib/libtorch_deploy.a(elf_file.cpp.o): relocation R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
CMakeFiles/example-app.dir/build.make:99: recipe for target 'example-app' failed
make[2]: *** [example-app] Error 1
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/example-app.dir/all' failed
make[1]: *** [CMakeFiles/example-app.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2

In the doc, -fPIC is only mentioned in build multipy from source. How to fix this problem for the release version?

Info:

Collecting environment information...
PyTorch version: 1.12.1
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.6 LTS (x86_64)
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Clang version: Could not collect
CMake version: version 3.22.5
Libc version: glibc-2.27

Python version: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:04:18)  [GCC 10.3.0] (64-bit runtime)
Python platform: Linux-5.4.0-1078-aws-x86_64-with-glibc2.10
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.2
[pip3] torch==1.12.1
[pip3] torchvision==0.13.1
[conda] blas                      1.0                         mkl    intel
[conda] cpuonly                   2.0                           0    pytorch
[conda] mkl                       2021.4.0              intel_640    intel
[conda] mkl-service               2.4.0            py38h95df7f1_0    conda-forge
[conda] mkl_fft                   1.3.1            py38h8666266_1    conda-forge
[conda] mkl_random                1.2.2            py38h1abd341_0    conda-forge
[conda] mkl_umath                 0.1.1            py38h244f2d4_9    intel
[conda] numpy                     1.23.2                   pypi_0    pypi
[conda] numpy-base                1.20.3           py38hf707ed8_2    intel
[conda] pytorch                   1.12.1              py3.8_cpu_0    pytorch
[conda] pytorch-mutex             1.0                         cpu    pytorch-nightly
[conda] torchvision               0.13.1                 py38_cpu    pytorch

Add Poetry build to multipy

As more projects are using Poetry, it would be good to add support to build off of poetry as we do off of pip

libpython_multipy.a: error adding symbols: File format not recognized

I attempted to build multipy on a Facebook devserver with a Conda install and it fails to build at link time with

[ 32%] Linking CXX shared library libtorch_deployinterpreter.so
/usr/bin/ld: libpython_multipy.a(abstract.o): unable to initialize decompress status for section .debug_info
/usr/bin/ld: libpython_multipy.a(abstract.o): unable to initialize decompress status for section .debug_info
libpython_multipy.a: error adding symbols: File format not recognized
collect2: error: ld returned 1 exit status

Should be reproducible by FB employees.

package issues with functions under C extensions

import torch

from torch.package import PackageExporter, PackageImporter

output_path = "/tmp/model.pt"



def save_load(model):
    with PackageExporter(output_path) as e:
        e.extern("torch.**")
        e.intern("**")
    
        e.save_pickle("model", "model.pkl", model)
    
    imp = PackageImporter(output_path)
    return imp.load_pickle("model", "model.pkl")

    print("pass")


model = torch.nn.TransformerEncoderLayer(
        d_model=64,
        nhead=2,
    dim_feedforward=64,
    dropout=1.0,
    batch_first=True,
    activation='gelu',
    norm_first=True,
)
save_load(model)

The issue is that F.gelu can't be loaded from package due to a nimport error

ModuleNotFoundError: No module named 'torch._C._nn'; 'torch._C' is not a package

Add explicit python 3.7, 3.9, and 3.10 support to `multipy/runtime`

We currently have python 3.8 support here, however, downstream customers such as torchrec support python 3.7+. Unfortunately because we need to explicitly link explicit versions of python as we need to make a small patch to the library, we can run into version mismatch errors in certain use cases.

Here we aim to add support for

  • Python 3.7
  • Python 3.9
  • Python 3.10

By default for now make the let python 3.8 by the default. We can use global variables to specify which version of python we'd want (ie. export MULTIPY_PYTHON_VERSION=3.10)

Create a Contributing.md

TL;DR: Build torch::deploy in OSS and run unit tests + document what you did.

Our Contributing.md was forgotten and is at the point where it "exists". We have gotten some complaints from developers that our development workflow instructions are not great. Fortunately, this presents a pretty good learning opportunity for newer developers.

  • Get on a Debian based system as that will make things easier.
  • Clone the repo using a standard git workflow
  • Follow the instructions for the Pip Installation up until actually running pip install then run these instructions to build
  • Document this build process in CONTRIBUTING.md
  • Run our unit tests
  • Document this build process in our CONTRIBUTING.md
  • Make some temporary changes into multipy/runtime/deploy.cpp (these can be print statements/ asserts/ whatever just don't commit them).
  • Test to confirm that your changes have occurred, and document the process in CONTRIBUTING.md.
  • Make some temporary changes into multipy/runtime/interpreter/interpreter_impl.cpp (these can be print statements/ asserts/ whatever just don't commit them).
  • Test to confirm that your changes have occurred, and document the process in CONTRIBUTING.md and mention that this process is only needed for changes that are specific to individual interpreters.
  • Create a Pull Request and press the button on the PR to import it into FBCode. The only file that is changed should be CONTRIBUTING.md, and submit it for review.

I expect there should be some trial and error with some of these steps. When you are recording things into the CONTRIBUTING.md think about how a user would avoid those situations. If you get stuck anywhere feel free to reach out to Sahan Paliskara.

Support Python 3.10

We had to remove Python 3.10 from the CI when migrating to this repo. We should update package to support Python 3.10 and revert 3cedbb8

Create E2E nightly / pr test for our example

We need to make sure our example doesn't get randomly broken. We should make an E2E test to ensure that it actually works!

We just need to go through the readme. We save the necessary files in a folder called multipy/examples, then we just need to reproduce the examples as a job using github actions in a file called multipy/.github/workflows/test_example.yaml. You can look at the other workflows to get an idea of how to create this one!

deploy/runtime: use a background thread to run GC when interpreters aren't executing the forward pass

To optimize the forward pass latency it would be good to time GC to run in between model executions. This won't improve the QPS since the GC cost is the same amoratized but it would make the latency lower per batch.

import gc

gc.collect()

We should spin up a background thread that periodically iterates over all of the interpreter threads -- locks them between execution and runs the GC. It might also be worth it to explicitly disable GC on the individual interpreter threads so they won't run during the forward pass.

Context:

https://fb.workplace.com/notes/538119557964077/

Embedded interpreter is 10% slower

Playing around with multipy, I found same program executed obviously slower in embedded interpreter. The original code is echo.py:

import time

def echo(_):
    start = time.time_ns()
    sum = 0
    for i in range(1000_000):
        sum += i
    cost = (time.time_ns() - start)/1000_000
    print(cost)

The cost is around 40 when executed by system python. It remains the same when bytecode generation(.pyc and__pycache__ files) is disabled.

40.741847
40.761805
40.764069
40.746884
40.773777
40.747697
40.765722
40.761535
40.782256

It is packaged by:

from torch.package import PackageExporter
from echo import echo

with PackageExporter("echo.zip") as ex:
    ex.intern("echo")
    ex.save_pickle("model", "model.pkl", echo)

and executed by multipy as follows:

int main(int argc, const char *argv[])
{
    if (argc != 3) {
        std::cerr << "usage: example-app <path-to-exported-script-module> thread_count\n";
        return -1;
    }

    torch::deploy::InterpreterManager manager(4);
    torch::deploy::ReplicatedObj model;
    try {
        torch::deploy::Package package = manager.loadPackage(argv[1]);
        model = package.loadPickle("model", "model.pkl");
        int n = std::stoi(argv[2]);
        for (int i=0; i<n; i++) {
            auto I = manager.acquireOne();
            auto echo = I.fromMovable(model);
            echo({1});
        }
        return 0;
    } catch (const c10::Error &e)
    {
        std::cerr << "error loading the model\n";
        std::cerr << e.msg();
        return -1;
    }
}

which prints out:

44.830043
45.339226
44.659302
44.789638
44.924977
44.725203
44.823946
44.660343
44.622977

why is it 10% slower?

Create a build-requirements.txt for CentOS 8.

TL;DR: Figure out the necessary dependencies for CentOS 8, and record them.

torch::deploy is usually developed on using Ubuntu, however, aws instances are not the most accessible. Therefore, we need to better define the build instructions for OSs like CentOS 8.

  • Clone the repository and download the submodules.
  • Follow the instructions to build torch::deploy. Instead of doing the pip install at the end it may be easier to do the cmake build process described here.
  • You will definitely run into problems when trying to install the packages in build-requirements.txt. However, it is a good starting point. Run cp build-requirements.txt build-requirements-centos8.txt, and replace the packages with the CentOS 8 equivalents. Then install the build requirements using build-requirements-centos8.txt and try to finish building torch::deploy. There will be a decent amount of trial and error.
  • Modify the README.md to call out build-requirements-centos8.txt
  • Change the name of build-requirements.txt -> build-requirements-debian.txt. Then replace all instances of build-requirements.txt with build-requirements-debian.txt in the repository.
  • Submit a PR, click on the import button in the PR, and ask for a review.

Please contact Sahan Paliskara if you run into any problems.

Question: is there any multi-threading inference example?

Hi
I have gone through the test examples but didn't find any multi-threading inference example. Maybe I missed it. Could you point such examples to me?

Or, is the experiment code for Fig.5 in this paper shared anywhere? If so could you point it to me too?

Thanks

package numpy support

If you use package w/ numpy you need to explicitly import numpy ahead of time otherwise it can cause issues since the numpy dependency of torch isn't currently tracked by torch.package.

Work Around

Calling .numpy() on a torch tensor before using package resolves this issue since torch will import numpy via the usual paths and use it as an extern.

torch.zeros(1).numpy()

support Mach-O/MacOS

Currently deploy only supports ELFs for the custom linker logic. It would be great to support Mach-O so we can use multiple in mac environments for use during training/dataloading as well as for users to test out local deployments

Using pyenv to dynamically link to python in `multipy/runtime`

At the moment, the primary reason we clone cpython from source and link to that is so we can add a small patch. However, we can emulate this patch by using pyenv and running the following command
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --force <python version>
(credit to @d4l3k for figuring this out)

By leveraging pyenv, we should be able to dynamically link to the system version of python such that users do not have to worry about mismatching python versions.

Rename `InterpreterSession.self` to `InterpreterSession.importer`

We should rename this to make this more clear that this is an importer not the actual interpreter. At the moment, it is pretty easy to confuse this variable as the interpreter itself, and given it's assigned from createOrGetPackageImporterFromContainerFile and the typing requires it to be a Obj. Instead, let's have a more descriptive name.

Migrate Test Infra to pytorch/test-infra

In the longer run it will be more scalable to use the general pytorch test-infra. Therefore, let's do it when ours is small :)

The annoying bit about this issue is that the workflow for building and testing multipy can no longer use docker as running a docker file within a docker file doesn't really work. (pytorch/test_infra creates a docker file with CentOS 7) Therefore, you have to build torch::deploy with the instructions in our README.md and then run the tests we run in the CI. The hardest part about this will be getting the dependencies right as build-requirements.txt is for a debian based system not CentOS 7. Therefore, you'll likely need to figure out the necessary dependencies through trial and error.

There should be with-ssh support which should help with debugging.

I also recommend taking a look at Github actions before starting. But generally with the pytorch/test_infra, you just have to set it up and then run a bash script to build torch::deploy + test it.

If you get stuck anywhere feel free to reach out to Sahan Paliskara.

Add unit testing for multiple python versions in `multipy/runtime`

We should add unit testing for explicitly using python interpreters from python versions which are not python 3.8.6, so we can detect if a change in python breaks something in multipy. Furthermore, the added testing covers usecases of downstream customers who do not use 3.8.6.

Dependencies:

Question: how much do we support non-PyTorch code like NumPy

This is a follow up question to the original question #296. It is basically the same as the comments in #296. But it is closed, so I don't know the comments there will be noticed. Sorry about this repetition.

In the original question, it is mentioned that the an interface for NumPy is needed to be registered into the interpreter. But it seems that, in the test examples, a python script can still have numpy dependency and is still working. For example, here
https://github.com/pytorch/multipy/blob/main/README.md#packaging-a-model-for-multipyruntime
the numpy packages installed in the system will be searched.

Does this mean NumPy is currently still somewhat supported by MultiPy? It is like, as long as I have numpy package installed, the python interpreters in MultiPy will load them during runtime and still be able to do multi-threading inference?

Here is another example, it can be imported with following code
I.global("numpy", "random"), which is from

TEST(TorchpyTest, TestNumpy) {
torch::deploy::InterpreterManager m(2);
auto noArgs = at::ArrayRef<torch::deploy::Obj>();
auto I = m.acquireOne();
auto mat35 = I.global("numpy", "random").attr("rand")({3, 5});
auto mat58 = I.global("numpy", "random").attr("rand")({5, 8});
auto mat38 = I.global("numpy", "matmul")({mat35, mat58});
EXPECT_EQ(2, mat38.attr("shape").attr("__len__")(noArgs).toIValue().toInt());
EXPECT_EQ(3, mat38.attr("shape").attr("__getitem__")({0}).toIValue().toInt());
EXPECT_EQ(8, mat38.attr("shape").attr("__getitem__")({1}).toIValue().toInt());
}

Given this, I'm wondering: what is the effect/purpose of registering the NumPy interface and

get numpy to convert to and from IValue

as was mentioned in question #296. What does this step do?

Problems in built-from-source pytorch with USE_DEPLOY=1 in Ubuntu

📚 The doc issue

Hi,

I'm trying the tutorial example of deploy and aim to package a model and do inference in C++. But I ran into a problems when working with build-from-source pytorch. There are following issue:

  1. Build-from-source on Ubuntu failed becasue of a missing file
    The error message is the following. Note that I have used CPU built by setting the environment variable as export USE_CUDA=0.
Building wheel torch-1.13.0a0+gitce92c1c
-- Building version 1.13.0a0+gitce92c1c
cmake --build . --target install --config Release
[1/214] Performing archive_stdlib step for 'cpython'
FAILED: torch/csrc/deploy/interpreter/cpython/src/cpython-stamp/cpython-archive_stdlib ../torch/csrc/deploy/interpreter/cpython/lib/libpython_stdlib3.8.a 
cd /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter && ar -rc /home/ubuntu/pytorch/torch/csrc/deploy/interpreter/cpython/lib/libpython_stdlib3.8.a /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/arraymodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_asynciomodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/audioop.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/binascii.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_bisectmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_blake2/blake2module.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_blake2/blake2b_impl.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_blake2/blake2s_impl.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_bz2module.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/cmathmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/cjkcodecs/_codecs_cn.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/cjkcodecs/_codecs_hk.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/cjkcodecs/_codecs_iso2022.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/cjkcodecs/_codecs_jp.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/cjkcodecs/_codecs_kr.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/cjkcodecs/_codecs_tw.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_contextvarsmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_cryptmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_csv.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_ctypes/_ctypes.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_ctypes/callbacks.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_ctypes/callproc.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_ctypes/stgdict.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_ctypes/cfield.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_ctypes/_ctypes_test.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_cursesmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_curses_panel.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_datetimemodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/_decimal.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/basearith.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/constants.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/context.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/convolute.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/crt.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/difradix2.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/fnt.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/fourstep.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/io.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/memory.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/mpdecimal.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/numbertheory.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/sixstep.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_decimal/libmpdec/transpose.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_elementtree.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/fcntlmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/grpmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_hashopenssl.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_heapqmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_json.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_lsprof.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_lzmamodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/mathmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/md5module.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/mmapmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/cjkcodecs/multibytecodec.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_multiprocessing/multiprocessing.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_multiprocessing/semaphore.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/nismodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_opcode.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/ossaudiodev.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/parsermodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_pickle.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_posixsubprocess.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/pyexpat.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/expat/xmlparse.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/expat/xmlrole.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/expat/xmltok.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_queuemodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_randommodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/readline.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/resource.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/selectmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/sha1module.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/sha256module.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_sha3/sha3module.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/sha512module.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/socketmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/spwdmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_ssl.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_struct.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/syslogmodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/termios.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_testbuffer.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_testcapimodule.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_testimportmultiple.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_testmultiphase.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/unicodedata.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/xxlimited.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_xxtestfuzz/_xxtestfuzz.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_xxtestfuzz/fuzzer.o /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/zlibmodule.o && /home/ubuntu/anaconda3/bin/cmake -E touch /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython-stamp/cpython-archive_stdlib
ar: /home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/build/temp.linux-x86_64-3.8//home/ubuntu/pytorch/build/torch/csrc/deploy/interpreter/cpython/src/cpython/Modules/_ctypes/_ctypes.o: No such file or directory
[3/214] Linking CXX shared library lib/libtorch_cpu.so
ninja: build stopped: subcommand failed.

I have also set export USE_DEPLOY=1 following (deploy tutorial)[https://pytorch.org/docs/stable/deploy.html#loading-and-running-the-model-in-c].

Any help will be appreciated!


Here is the system info:

Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.6 LTS (x86_64)
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Clang version: Could not collect
CMake version: version 3.20.2
Libc version: glibc-2.27

Python version: 3.9.12 (main, Apr  5 2022, 06:56:58)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.4.0-1068-aws-x86_64-with-glibc2.27
Is CUDA available: N/A
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: Tesla T4
Nvidia driver version: 510.47.03
cuDNN version: Probably one of the following:
/usr/local/cuda-11.0/targets/x86_64-linux/lib/libcudnn.so.8.0.5
/usr/local/cuda-11.0/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.0.5
/usr/local/cuda-11.0/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.0.5
/usr/local/cuda-11.0/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.0.5
/usr/local/cuda-11.0/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.0.5
/usr/local/cuda-11.0/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.0.5
/usr/local/cuda-11.0/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.0.5
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn.so.8.0.5
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.0.5
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.0.5
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.0.5
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.0.5
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.0.5
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.0.5
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn.so.8.1.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.1.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.1.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.1.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.1.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.1.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.1.1
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

Versions of relevant libraries:
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.21.5
[pip3] numpydoc==1.2
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas                      1.0                         mkl  
[conda] cpuonly                   2.0                           0    pytorch
[conda] cudatoolkit               11.2.2               he111cf0_8    conda-forge
[conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
[conda] magma-cuda112             2.5.2                         1    pytorch
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-include               2022.1.0           h84fe81f_915    conda-forge
[conda] mkl-service               2.4.0            py39h7f8727e_0  
[conda] mkl_fft                   1.3.1            py39hd3c417c_0  
[conda] mkl_random                1.2.2            py39h51133e4_0  
[conda] numpy                     1.21.5           py39he7a7128_1  
[conda] numpy-base                1.21.5           py39hf524024_1  
[conda] numpydoc                  1.2                pyhd3eb1b0_0  
[conda] pytorch                   1.12.0              py3.9_cpu_0    pytorch
[conda] pytorch-mutex             1.0                         cpu    pytorch
[conda] torchaudio                0.12.0                 py39_cpu    pytorch
[conda] torchvision               0.13.0                 py39_cpu    pytorch

Suggest a potential alternative/fix

No response

cc @wconstab

Fail to load package contains huggingface transformer in Torch::Deploy

I try to dump a model contains huggingface transformer into a package and then load it in Torch::Deploy. During dumping, everything is OK, while loading it in Torch::Deploy it crashes and throws following error message:

terminate called after throwing an instance of 'std::runtime_error'
  what():  Exception Caught inside torch::deploy embedded library:
Exception Caught inside torch::deploy embedded library:
ModuleNotFoundError: No module named 'torch._C._nn'; 'torch._C' is not a package

At:
  <Generated by torch::deploy>(436): _do_find_and_load
  <Generated by torch::deploy>(448): _find_and_load
  <Generated by torch::deploy>(478): _gcd_import
  <Generated by torch::deploy>(148): import_module
  <Generated by torch::deploy>(25): find_class
  <Generated by torch::deploy>(1526): load_global
  <Generated by torch::deploy>(1212): load
  <Generated by torch::deploy>(270): load_pickle

Aborted (core dumped)

Here is my model's definition, only contains a huggingface tokenizer and a BERT model.

# file name: bert_model.py

import torch
from transformers import BertTokenizer, BertModel

class MyBertModel(torch.nn.Module):
    def __init__(self) -> None:
        super().__init__()
        self._tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
        self._model = BertModel.from_pretrained("bert-base-uncased")

    def forward(self, x):
        encoded_input = self._tokenizer(x, return_tensors='pt')
        return self._model(**encoded_input)

Here is how I dump this model with torch package:

from torch.package import PackageExporter
from bert_model import MyBertModel

model = MyBertModel()

# Package and export it.
with PackageExporter("bert_package.pt") as e:
    e.intern('bert_model')
    e.extern("sys")
    e.extern("transformers")
    e.save_pickle("model", "model.pkl", model)

The package is loaded in the way showed in the demo: https://pytorch.org/docs/1.12/deploy.html#loading-and-running-the-model-in-c

Can anyone helps? Many thanks!

More generally support python in Multipy

Currently, we only truly support python 3.8.6 for multipy/runtime and 3.7-3.9 for multipy.package. If we want general availability/ ease of use, we should not constrain users like this, but rather make these tools more available for users who want features of python above version 3.7.

Support more python versions in multipy/runtime

Support more python versions in multipy.package

Have docs push action exit gracefully when there are no new docs

Currently when there are no changes in our docs, they create a failing github action like so which is noisy. Let's solve this issue :)

  • Clone the repository
  • Comment out this line for testing
  • Modify docs-build.yaml such that it gracefully exits before running git push if there are no changes in the docs.
  • For some context, this github action builds docs based on the source code found in the multipy folder (not .github), and then pushes them to https://github.com/pytorch/multipy/tree/gh-pages which is the source for our website. This stackoverflow thread may be helpful for checking if you should just exit.
  • Create a Pull Request
  • Comment back in this line after testing is done, and the PR works.
  • Add a link to a successful run to the description of the PR.
  • press the button on the PR to import it into Phabricator and ask for a review.

I also recommend taking a look at Github actions before starting.

If you get stuck anywhere feel free to reach out to Sahan Paliskara.

A quesion in test_deploy example

There is a line of code that seems problematic.

# result = w.grad
result = torch.Tensor([1,2,3])

In this test of autograd, why is result = w.grad commented while keeping another hardcoding result? I have tried to uncomment the former and comment the latter. Then AutoGrad test failed. Is there an issue there?

Bug in building pytorch deploy from source in macos USE_DEPLOY=1

🐛 Describe the bug

I'm trying to use the torch::deploy feature, and follow the document in this website to build pytorch from source. First, I suceeded in building it with USE_DEPLOY=0. Then I started fresh (I cleaned with the instruction on this website, with USE_DEPLOY=1. But it failes. This is done in Macos system. The same issue happens in a linux system too (See this issue).

Could you help me check this or show me a working example of installing torch::deploy from source?

  • The command:
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
export USE_DEPLOY=1

DEBUG=1 USE_DISTRIBUTED=0 USE_MKLDNN=0 USE_CUDA=0 BUILD_TEST=0 USE_FBGEMM=0 USE_NNPACK=0 USE_QNNPACK=0 USE_XNNPACK=0 MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py develop
  • The error message:
Building wheel torch-1.13.0a0+git8a6c104
-- Building version 1.13.0a0+git8a6c104
cmake -GNinja -DBUILD_PYTHON=True -DBUILD_TEST=False -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=/Users/fenkexin/Desktop/forked/pytorch/torch -DCMAKE_PREFIX_PATH=/Users/fenkexin/opt/anaconda3/lib/python3.9/site-packages;/Users/fenkexin/opt/anaconda3 -DJAVA_HOME=/Users/fenkexin/Library/Java/JavaVirtualMachines/corretto-11.0.14.1/Contents/Home -DNUMPY_INCLUDE_DIR=/Users/fenkexin/opt/anaconda3/lib/python3.9/site-packages/numpy/core/include -DPYTHON_EXECUTABLE=/Users/fenkexin/opt/anaconda3/bin/python -DPYTHON_INCLUDE_DIR=/Users/fenkexin/opt/anaconda3/include/python3.9 -DPYTHON_LIBRARY=/Users/fenkexin/opt/anaconda3/lib/libpython3.9.a -DTORCH_BUILD_VERSION=1.13.0a0+git8a6c104 -DUSE_CUDA=0 -DUSE_DEPLOY=1 -DUSE_DISTRIBUTED=0 -DUSE_FBGEMM=0 -DUSE_MKLDNN=0 -DUSE_NNPACK=0 -DUSE_NUMPY=True -DUSE_QNNPACK=0 -DUSE_XNNPACK=0 /Users/fenkexin/Desktop/forked/pytorch
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- The C compiler identification is AppleClang 13.1.6.13160021
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Not forcing any particular BLAS to be found
-- CLANG_VERSION_STRING:         Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

-- sdk version: 12.3, mps supported: ON
-- MPSGraph framework found
-- Performing Test COMPILER_WORKS
-- Performing Test COMPILER_WORKS - Success
-- Performing Test SUPPORT_GLIBCXX_USE_C99
-- Performing Test SUPPORT_GLIBCXX_USE_C99 - Success
-- Performing Test CAFFE2_EXCEPTION_PTR_SUPPORTED
-- Performing Test CAFFE2_EXCEPTION_PTR_SUPPORTED - Success
-- std::exception_ptr is supported.
-- Performing Test CAFFE2_NEED_TO_TURN_OFF_DEPRECATION_WARNING
-- Performing Test CAFFE2_NEED_TO_TURN_OFF_DEPRECATION_WARNING - Failed
-- Turning off deprecation warning due to glog.
-- Performing Test C_HAS_AVX_1
-- Performing Test C_HAS_AVX_1 - Failed
-- Performing Test C_HAS_AVX_2
-- Performing Test C_HAS_AVX_2 - Success
-- Performing Test C_HAS_AVX2_1
-- Performing Test C_HAS_AVX2_1 - Failed
-- Performing Test C_HAS_AVX2_2
-- Performing Test C_HAS_AVX2_2 - Success
-- Performing Test C_HAS_AVX512_1
-- Performing Test C_HAS_AVX512_1 - Failed
-- Performing Test C_HAS_AVX512_2
-- Performing Test C_HAS_AVX512_2 - Failed
-- Performing Test C_HAS_AVX512_3
-- Performing Test C_HAS_AVX512_3 - Failed
-- Performing Test CXX_HAS_AVX_1
-- Performing Test CXX_HAS_AVX_1 - Failed
-- Performing Test CXX_HAS_AVX_2
-- Performing Test CXX_HAS_AVX_2 - Success
-- Performing Test CXX_HAS_AVX2_1
-- Performing Test CXX_HAS_AVX2_1 - Failed
-- Performing Test CXX_HAS_AVX2_2
-- Performing Test CXX_HAS_AVX2_2 - Success
-- Performing Test CXX_HAS_AVX512_1
-- Performing Test CXX_HAS_AVX512_1 - Failed
-- Performing Test CXX_HAS_AVX512_2
-- Performing Test CXX_HAS_AVX512_2 - Failed
-- Performing Test CXX_HAS_AVX512_3
-- Performing Test CXX_HAS_AVX512_3 - Failed
-- Current compiler supports avx2 extension. Will build perfkernels.
-- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS
-- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS - Success
-- Current compiler supports avx512f extension. Will build fbgemm.
-- Performing Test COMPILER_SUPPORTS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_SUPPORTS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_SUPPORTS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_SUPPORTS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_SUPPORTS_RDYNAMIC
-- Performing Test COMPILER_SUPPORTS_RDYNAMIC - Success
-- Building using own protobuf under third_party per request.
-- Use custom protobuf build.
-- 
-- 3.13.0.0
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Success
-- Caffe2 protobuf include directory: $<BUILD_INTERFACE:/Users/fenkexin/Desktop/forked/pytorch/third_party/protobuf/src>$<INSTALL_INTERFACE:include>
-- Trying to find preferred BLAS backend of choice: MKL
-- MKL_THREADING = OMP
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Looking for cblas_sgemm
-- Looking for cblas_sgemm - found
-- MKL libraries: /Users/fenkexin/opt/anaconda3/lib/libmkl_intel_lp64.dylib;/Users/fenkexin/opt/anaconda3/lib/libmkl_intel_thread.dylib;/Users/fenkexin/opt/anaconda3/lib/libmkl_core.dylib;/Users/fenkexin/opt/anaconda3/lib/libiomp5.dylib;/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libpthread.tbd;/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libm.tbd
-- MKL include directory: /Users/fenkexin/opt/anaconda3/include
-- MKL OpenMP type: Intel
-- MKL OpenMP library: /Users/fenkexin/opt/anaconda3/lib/libiomp5.dylib
-- The ASM compiler identification is Clang
-- Found assembler: /Library/Developer/CommandLineTools/usr/bin/clang
CMake Warning at cmake/Dependencies.cmake:844 (message):
  Turning USE_FAKELOWP off as it depends on USE_FBGEMM.
Call Stack (most recent call first):
  CMakeLists.txt:708 (include)


-- Using third party subdirectory Eigen.
-- Found PythonInterp: /Users/fenkexin/opt/anaconda3/bin/python (found suitable version "3.9.12", minimum required is "3.0") 
-- Found PythonLibs: /Users/fenkexin/opt/anaconda3/lib/libpython3.9.a (found suitable version "3.9.12", minimum required is "3.0") 
-- Using third_party/pybind11.
-- pybind11 include dirs: /Users/fenkexin/Desktop/forked/pytorch/cmake/../third_party/pybind11/include
CMake Warning (dev) at /Users/fenkexin/opt/anaconda3/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:426 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_C)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:576 (find_package_handle_standard_args)
  cmake/Dependencies.cmake:1222 (find_package)
  CMakeLists.txt:708 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /Users/fenkexin/opt/anaconda3/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:426 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_CXX)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:576 (find_package_handle_standard_args)
  cmake/Dependencies.cmake:1222 (find_package)
  CMakeLists.txt:708 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Adding OpenMP CXX_FLAGS: -Xpreprocessor -fopenmp -I/Users/fenkexin/opt/anaconda3/include
-- Will link against OpenMP libraries: /Users/fenkexin/opt/anaconda3/lib/libiomp5.dylib
CMake Warning at cmake/Dependencies.cmake:1513 (message):
  Metal is only used in ios builds.
Call Stack (most recent call first):
  CMakeLists.txt:708 (include)


-- Found PythonInterp: /Users/fenkexin/opt/anaconda3/bin/python (found version "3.9.12") 
-- Found PythonLibs: /Users/fenkexin/opt/anaconda3/lib/libpython3.9.a (found version "3.9.12") 
Generated: /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.proto
Generated: /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.proto
Generated: /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx-data_onnx_torch.proto
-- 
-- ******** Summary ********
--   CMake version             : 3.19.6
--   CMake command             : /Users/fenkexin/opt/anaconda3/bin/cmake
--   System                    : Darwin
--   C++ compiler              : /Library/Developer/CommandLineTools/usr/bin/clang++
--   C++ compiler version      : 13.1.6.13160021
--   CXX flags                 :  -Wno-deprecated -fvisibility-inlines-hidden -Wno-deprecated-declarations -DUSE_PTHREADPOOL -Xpreprocessor -fopenmp -I/Users/fenkexin/opt/anaconda3/include -Wnon-virtual-dtor
--   Build type                : Debug
--   Compile definitions       : ONNX_ML=1;ONNXIFI_ENABLE_EXT=1;__STDC_FORMAT_MACROS
--   CMAKE_PREFIX_PATH         : /Users/fenkexin/opt/anaconda3/lib/python3.9/site-packages;/Users/fenkexin/opt/anaconda3
--   CMAKE_INSTALL_PREFIX      : /Users/fenkexin/Desktop/forked/pytorch/torch
--   CMAKE_MODULE_PATH         : /Users/fenkexin/Desktop/forked/pytorch/cmake/Modules
-- 
--   ONNX version              : 1.12.0
--   ONNX NAMESPACE            : onnx_torch
--   ONNX_USE_LITE_PROTO       : OFF
--   USE_PROTOBUF_SHARED_LIBS  : OFF
--   Protobuf_USE_STATIC_LIBS  : ON
--   ONNX_DISABLE_EXCEPTIONS   : OFF
--   ONNX_WERROR               : OFF
--   ONNX_BUILD_TESTS          : OFF
--   ONNX_BUILD_BENCHMARKS     : OFF
--   ONNXIFI_DUMMY_BACKEND     : OFF
--   ONNXIFI_ENABLE_EXT        : OFF
-- 
--   Protobuf compiler         : 
--   Protobuf includes         : 
--   Protobuf libraries        : 
--   BUILD_ONNX_PYTHON         : OFF
-- 
-- ******** Summary ********
--   CMake version         : 3.19.6
--   CMake command         : /Users/fenkexin/opt/anaconda3/bin/cmake
--   System                : Darwin
--   C++ compiler          : /Library/Developer/CommandLineTools/usr/bin/clang++
--   C++ compiler version  : 13.1.6.13160021
--   CXX flags             :  -Wno-deprecated -fvisibility-inlines-hidden -Wno-deprecated-declarations -DUSE_PTHREADPOOL -Xpreprocessor -fopenmp -I/Users/fenkexin/opt/anaconda3/include -Wnon-virtual-dtor
--   Build type            : Debug
--   Compile definitions   : ONNX_ML=1;ONNXIFI_ENABLE_EXT=1
--   CMAKE_PREFIX_PATH     : /Users/fenkexin/opt/anaconda3/lib/python3.9/site-packages;/Users/fenkexin/opt/anaconda3
--   CMAKE_INSTALL_PREFIX  : /Users/fenkexin/Desktop/forked/pytorch/torch
--   CMAKE_MODULE_PATH     : /Users/fenkexin/Desktop/forked/pytorch/cmake/Modules
-- 
--   ONNX version          : 1.4.1
--   ONNX NAMESPACE        : onnx_torch
--   ONNX_BUILD_TESTS      : OFF
--   ONNX_BUILD_BENCHMARKS : OFF
--   ONNX_USE_LITE_PROTO   : OFF
--   ONNXIFI_DUMMY_BACKEND : OFF
-- 
--   Protobuf compiler     : 
--   Protobuf includes     : 
--   Protobuf libraries    : 
--   BUILD_ONNX_PYTHON     : OFF
-- Could not find CUDA with FP16 support, compiling without torch.CudaHalfTensor
-- Removing -DNDEBUG from compile flags
-- Checking prototype magma_get_sgeqrf_nb for MAGMA_V2
-- Checking prototype magma_get_sgeqrf_nb for MAGMA_V2 - False
CMake Warning at cmake/Dependencies.cmake:1713 (message):
  Not compiling with MAGMA.  Suppress this warning with -DUSE_MAGMA=OFF.
Call Stack (most recent call first):
  CMakeLists.txt:708 (include)


-- Could not find hardware support for NEON on this machine.
-- No OMAP3 processor on this machine.
-- No OMAP4 processor on this machine.
-- Found a library with LAPACK API (mkl).
disabling CUDA because NOT USE_CUDA is set
-- USE_CUDNN is set to 0. Compiling without cuDNN support
disabling ROCM because NOT USE_ROCM is set
-- MIOpen not found. Compiling without MIOpen support
disabling MKLDNN because USE_MKLDNN is not set
-- Looking for mmap
-- Looking for mmap - found
-- Looking for shm_open
-- Looking for shm_open - found
-- Looking for shm_unlink
-- Looking for shm_unlink - found
-- Looking for malloc_usable_size
-- Looking for malloc_usable_size - not found
-- Performing Test C_HAS_THREAD
-- Performing Test C_HAS_THREAD - Success
-- Version: 7.0.3
-- Build type: Debug
-- CXX_STANDARD: 14
-- Performing Test has_std_14_flag
-- Performing Test has_std_14_flag - Success
-- Performing Test has_std_1y_flag
-- Performing Test has_std_1y_flag - Success
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS - Success
-- Performing Test FMT_HAS_VARIANT
-- Performing Test FMT_HAS_VARIANT - Success
-- Required features: cxx_variadic_templates
-- Performing Test HAS_NULLPTR_WARNING
-- Performing Test HAS_NULLPTR_WARNING - Success
-- Looking for strtod_l
-- Looking for strtod_l - found
-- Using CPU-only version of Kineto
-- Configuring Kineto dependency:
--   KINETO_SOURCE_DIR = /Users/fenkexin/Desktop/forked/pytorch/third_party/kineto/libkineto
--   KINETO_BUILD_TESTS = OFF
--   KINETO_LIBRARY_TYPE = static
INFO CUDA_SOURCE_DIR = 
INFO ROCM_SOURCE_DIR = 
INFO CUPTI unavailable or disabled - not building GPU profilers
-- Kineto: FMT_SOURCE_DIR = /Users/fenkexin/Desktop/forked/pytorch/third_party/fmt
-- Kineto: FMT_INCLUDE_DIR = /Users/fenkexin/Desktop/forked/pytorch/third_party/fmt/include
INFO CUPTI_INCLUDE_DIR = /extras/CUPTI/include
INFO ROCTRACER_INCLUDE_DIR = /include/roctracer
-- Configured Kineto (CPU)
-- Performing Test HAS_WERROR_FORMAT
-- Performing Test HAS_WERROR_FORMAT - Success
-- Performing Test HAS_WERROR_CAST_FUNCTION_TYPE
-- Performing Test HAS_WERROR_CAST_FUNCTION_TYPE - Success
-- Performing Test HAS_WERROR_SIGN_COMPARE
-- Performing Test HAS_WERROR_SIGN_COMPARE - Success
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include  
-- don't use NUMA
-- headers outputs: 
-- sources outputs: 
-- declarations_yaml outputs: 
-- Performing Test COMPILER_SUPPORTS_NO_AVX256_SPLIT
-- Performing Test COMPILER_SUPPORTS_NO_AVX256_SPLIT - Failed
-- Using ATen parallel backend: OMP
disabling CUDA because USE_CUDA is set false
CMake Deprecation Warning at third_party/sleef/CMakeLists.txt:91 (cmake_policy):
  The OLD behavior for policy CMP0066 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- Found OpenSSL: /Users/fenkexin/opt/anaconda3/lib/libcrypto.dylib (found version "1.1.1q")  
-- Check size of long double
-- Check size of long double - done
-- Performing Test COMPILER_SUPPORTS_LONG_DOUBLE
-- Performing Test COMPILER_SUPPORTS_LONG_DOUBLE - Success
-- Performing Test COMPILER_SUPPORTS_FLOAT128
-- Performing Test COMPILER_SUPPORTS_FLOAT128 - Failed
-- Performing Test COMPILER_SUPPORTS_SSE2
-- Performing Test COMPILER_SUPPORTS_SSE2 - Success
-- Performing Test COMPILER_SUPPORTS_SSE4
-- Performing Test COMPILER_SUPPORTS_SSE4 - Success
-- Performing Test COMPILER_SUPPORTS_AVX
-- Performing Test COMPILER_SUPPORTS_AVX - Success
-- Performing Test COMPILER_SUPPORTS_FMA4
-- Performing Test COMPILER_SUPPORTS_FMA4 - Success
-- Performing Test COMPILER_SUPPORTS_AVX2
-- Performing Test COMPILER_SUPPORTS_AVX2 - Success
-- Performing Test COMPILER_SUPPORTS_AVX512F
-- Performing Test COMPILER_SUPPORTS_AVX512F - Success
-- Found OpenMP_C: -Xpreprocessor -fopenmp -I/Users/fenkexin/opt/anaconda3/include (found version "5.0") 
-- Found OpenMP_CXX: -Xpreprocessor -fopenmp -I/Users/fenkexin/opt/anaconda3/include (found version "5.0") 
-- Found OpenMP: TRUE (found version "5.0")  
-- Performing Test COMPILER_SUPPORTS_OPENMP
-- Performing Test COMPILER_SUPPORTS_OPENMP - Failed
-- Performing Test COMPILER_SUPPORTS_WEAK_ALIASES
-- Performing Test COMPILER_SUPPORTS_WEAK_ALIASES - Failed
-- Performing Test COMPILER_SUPPORTS_BUILTIN_MATH
-- Performing Test COMPILER_SUPPORTS_BUILTIN_MATH - Success
-- Performing Test COMPILER_SUPPORTS_SYS_GETRANDOM
-- Performing Test COMPILER_SUPPORTS_SYS_GETRANDOM - Failed
-- Configuring build for SLEEF-v3.6.0
   Target system: Darwin-21.6.0
   Target processor: x86_64
   Host system: Darwin-21.6.0
   Host processor: x86_64
   Detected C compiler: AppleClang @ /Library/Developer/CommandLineTools/usr/bin/clang
   CMake: 3.19.6
   Make program: /Users/fenkexin/opt/anaconda3/bin/ninja
-- Using option `-Wall -Wno-unused -Wno-attributes -Wno-unused-result -ffp-contract=off -fno-math-errno -fno-trapping-math` to compile libsleef
-- Building shared libs : OFF
-- Building static test bins: OFF
-- MPFR : /usr/local/lib/libmpfr.dylib
-- MPFR header file in /usr/local/include
-- GMP : /usr/local/lib/libgmp.dylib
-- RT : 
-- FFTW3 : LIBFFTW3-NOTFOUND
-- OPENSSL : 1.1.1q
-- SDE : SDE_COMMAND-NOTFOUND
-- RUNNING_ON_TRAVIS : 
-- COMPILER_SUPPORTS_OPENMP : 
AT_INSTALL_INCLUDE_DIR include/ATen/core
core header install: /Users/fenkexin/Desktop/forked/pytorch/build/aten/src/ATen/core/TensorBody.h
core header install: /Users/fenkexin/Desktop/forked/pytorch/build/aten/src/ATen/core/aten_interned_strings.h
core header install: /Users/fenkexin/Desktop/forked/pytorch/build/aten/src/ATen/core/enum_tag.h
CMake Warning (dev) at torch/CMakeLists.txt:467:
  Syntax Warning in cmake code at column 107

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at torch/CMakeLists.txt:467:
  Syntax Warning in cmake code at column 115

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /Users/fenkexin/opt/anaconda3/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:426 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_C)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:576 (find_package_handle_standard_args)
  caffe2/CMakeLists.txt:1288 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /Users/fenkexin/opt/anaconda3/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:426 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_CXX)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:576 (find_package_handle_standard_args)
  caffe2/CMakeLists.txt:1288 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- pytorch is compiling with OpenMP. 
OpenMP CXX_FLAGS: -Xpreprocessor -fopenmp -I/Users/fenkexin/opt/anaconda3/include. 
OpenMP libraries: /Users/fenkexin/opt/anaconda3/lib/libiomp5.dylib.
-- Caffe2 is compiling with OpenMP. 
OpenMP CXX_FLAGS: -Xpreprocessor -fopenmp -I/Users/fenkexin/opt/anaconda3/include. 
OpenMP libraries: /Users/fenkexin/opt/anaconda3/lib/libiomp5.dylib.
-- Using lib/python3.9/site-packages as python relative installation path
CMake Warning at CMakeLists.txt:1073 (message):
  Generated cmake files are only fully tested if one builds with system glog,
  gflags, and protobuf.  Other settings may generate files that are not well
  tested.


-- 
-- ******** Summary ********
-- General:
--   CMake version         : 3.19.6
--   CMake command         : /Users/fenkexin/opt/anaconda3/bin/cmake
--   System                : Darwin
--   C++ compiler          : /Library/Developer/CommandLineTools/usr/bin/clang++
--   C++ compiler id       : AppleClang
--   C++ compiler version  : 13.1.6.13160021
--   Using ccache if found : ON
--   Found ccache          : /Users/fenkexin/opt/anaconda3/bin/ccache
--   CXX flags             :  -Wno-deprecated -fvisibility-inlines-hidden -Wno-deprecated-declarations -DUSE_PTHREADPOOL -Xpreprocessor -fopenmp -I/Users/fenkexin/opt/anaconda3/include -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_PYTORCH_QNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-range-loop-analysis -Wno-pass-failed -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -Wconstant-conversion -Wno-invalid-partial-specialization -Wno-typedef-redefinition -Wno-unknown-warning-option -Wno-unused-private-field -Wno-inconsistent-missing-override -Wno-aligned-allocation-unavailable -Wno-c++14-extensions -Wno-constexpr-not-const -Wno-missing-braces -Qunused-arguments -fcolor-diagnostics -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -DUSE_MPS -fno-objc-arc -Wno-unused-private-field -Wno-missing-braces -Wno-c++14-extensions -Wno-constexpr-not-const
--   Build type            : Debug
--   Compile definitions   : ONNX_ML=1;ONNXIFI_ENABLE_EXT=1;ONNX_NAMESPACE=onnx_torch;HAVE_MMAP=1;_FILE_OFFSET_BITS=64;HAVE_SHM_OPEN=1;HAVE_SHM_UNLINK=1;USE_EXTERNAL_MZCRC;MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
--   CMAKE_PREFIX_PATH     : /Users/fenkexin/opt/anaconda3/lib/python3.9/site-packages;/Users/fenkexin/opt/anaconda3
--   CMAKE_INSTALL_PREFIX  : /Users/fenkexin/Desktop/forked/pytorch/torch
--   USE_GOLD_LINKER       : OFF
-- 
--   TORCH_VERSION         : 1.13.0
--   CAFFE2_VERSION        : 1.13.0
--   BUILD_CAFFE2          : OFF
--   BUILD_CAFFE2_OPS      : OFF
--   BUILD_CAFFE2_MOBILE   : OFF
--   BUILD_STATIC_RUNTIME_BENCHMARK: OFF
--   BUILD_TENSOREXPR_BENCHMARK: OFF
--   BUILD_NVFUSER_BENCHMARK: OFF
--   BUILD_BINARY          : OFF
--   BUILD_CUSTOM_PROTOBUF : ON
--     Link local protobuf : ON
--   BUILD_DOCS            : OFF
--   BUILD_PYTHON          : True
--     Python version      : 3.9.12
--     Python executable   : /Users/fenkexin/opt/anaconda3/bin/python
--     Pythonlibs version  : 3.9.12
--     Python library      : /Users/fenkexin/opt/anaconda3/lib/libpython3.9.a
--     Python includes     : /Users/fenkexin/opt/anaconda3/include/python3.9
--     Python site-packages: lib/python3.9/site-packages
--   BUILD_SHARED_LIBS     : ON
--   CAFFE2_USE_MSVC_STATIC_RUNTIME     : OFF
--   BUILD_TEST            : False
--   BUILD_JNI             : OFF
--   BUILD_MOBILE_AUTOGRAD : OFF
--   BUILD_LITE_INTERPRETER: OFF
--   CROSS_COMPILING_MACOSX : 
--   INTERN_BUILD_MOBILE   : 
--   USE_BLAS              : 1
--     BLAS                : mkl
--     BLAS_HAS_SBGEMM     : 
--   USE_LAPACK            : 1
--     LAPACK              : mkl
--   USE_ASAN              : OFF
--   USE_CPP_CODE_COVERAGE : OFF
--   USE_CUDA              : 0
--   USE_ROCM              : OFF
--   USE_EIGEN_FOR_BLAS    : 
--   USE_FBGEMM            : OFF
--     USE_FAKELOWP          : OFF
--   USE_KINETO            : ON
--   USE_FFMPEG            : OFF
--   USE_GFLAGS            : OFF
--   USE_GLOG              : OFF
--   USE_LEVELDB           : OFF
--   USE_LITE_PROTO        : OFF
--   USE_LMDB              : OFF
--   USE_METAL             : OFF
--   USE_PYTORCH_METAL     : OFF
--   USE_PYTORCH_METAL_EXPORT     : OFF
--   USE_MPS               : ON
--   USE_FFTW              : OFF
--   USE_MKL               : ON
--   USE_MKLDNN            : 0
--   USE_UCC               : OFF
--   USE_ITT               : ON
--   USE_NCCL              : OFF
--   USE_NNPACK            : 0
--   USE_NUMPY             : ON
--   USE_OBSERVERS         : ON
--   USE_OPENCL            : OFF
--   USE_OPENCV            : OFF
--   USE_OPENMP            : ON
--   USE_TBB               : OFF
--   USE_VULKAN            : OFF
--   USE_PROF              : OFF
--   USE_QNNPACK           : 0
--   USE_PYTORCH_QNNPACK   : ON
--   USE_XNNPACK           : 0
--   USE_REDIS             : OFF
--   USE_ROCKSDB           : OFF
--   USE_ZMQ               : OFF
--   USE_DISTRIBUTED       : 0
--   USE_DEPLOY           : 1
--   Public Dependencies  : caffe2::Threads;caffe2::mkl
--   Private Dependencies : pthreadpool;cpuinfo;pytorch_qnnpack;ittnotify;fp16;foxi_loader;fmt::fmt-header-only;kineto
--   USE_COREML_DELEGATE     : OFF
--   BUILD_LAZY_TS_BACKEND   : ON
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    JAVA_HOME


-- Build files have been written to: /Users/fenkexin/Desktop/forked/pytorch/build
cmake --build . --target install --config Debug
[3/4] Generating ATen headers
[229/1806] Linking CXX static library lib/libprotobuf-lited.a
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: lib/libprotobuf-lited.a(io_win32.cc.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: lib/libprotobuf-lited.a(io_win32.cc.o) has no symbols
[289/1806] Linking CXX static library lib/libprotobufd.a
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: lib/libprotobufd.a(io_win32.cc.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: lib/libprotobufd.a(gzip_stream.cc.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: lib/libprotobufd.a(error_listener.cc.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: lib/libprotobufd.a(io_win32.cc.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: lib/libprotobufd.a(gzip_stream.cc.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: lib/libprotobufd.a(error_listener.cc.o) has no symbols
[327/1806] Running gen_proto.py on onnx/onnx.in.proto
Processing /Users/fenkexin/Desktop/forked/pytorch/third_party/onnx/onnx/onnx.in.proto
Writing /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.proto
Writing /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.proto3
Writing /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx-ml.pb.h
generating /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx_pb.py
[341/1806] Running gen_proto.py on onnx/onnx-operators.in.proto
Processing /Users/fenkexin/Desktop/forked/pytorch/third_party/onnx/onnx/onnx-operators.in.proto
Writing /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.proto
Writing /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.proto3
Writing /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx-operators-ml.pb.h
generating /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx_operators_pb.py
[342/1806] Running gen_proto.py on onnx/onnx-data.in.proto
Processing /Users/fenkexin/Desktop/forked/pytorch/third_party/onnx/onnx/onnx-data.in.proto
Writing /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx-data_onnx_torch.proto
Writing /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx-data_onnx_torch.proto3
Writing /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx-data.pb.h
generating /Users/fenkexin/Desktop/forked/pytorch/build/third_party/onnx/onnx/onnx_data_pb.py
[424/1806] Linking C shared library lib/libtorch_global_deps.dylib
ld: warning: dylib (/Users/fenkexin/opt/anaconda3/lib/libmkl_intel_lp64.dylib) was built for newer macOS version (10.12) than being linked (10.9)
ld: warning: dylib (/Users/fenkexin/opt/anaconda3/lib/libmkl_intel_thread.dylib) was built for newer macOS version (10.12) than being linked (10.9)
ld: warning: dylib (/Users/fenkexin/opt/anaconda3/lib/libmkl_core.dylib) was built for newer macOS version (10.12) than being linked (10.9)
[443/1806] Generating include/renameavx2128.h
Generating renameavx2128.h: mkrename finz_ 2 4 avx2128
[444/1806] Generating include/renameavx512fnofma.h
Generating renameavx512fnofma.h: mkrename cinz_ 8 16 avx512fnofma
[445/1806] Generating include/renamesse2.h
Generating renamesse2.h: mkrename cinz_ 2 4 sse2
[447/1806] Generating include/renamepurecfma_scalar.h
Generating renamepurecfma_scalar.h: mkrename finz_ 1 1 purecfma
[448/1806] Generating include/renamepurec_scalar.h
Generating renamepurec_scalar.h: mkrename cinz_ 1 1 purec
[449/1806] Generating include/renamesse4.h
Generating renamesse4.h: mkrename cinz_ 2 4 sse4
[450/1806] Generating include/renameavx.h
Generating renameavx.h: mkrename cinz_ 4 8 avx
[451/1806] Generating include/renamefma4.h
Generating renamefma4.h: mkrename finz_ 4 8 fma4
[452/1806] Generating include/renameavx2.h
Generating renameavx2.h: mkrename finz_ 4 8 avx2
[453/1806] Generating include/renameavx512f.h
Generating renameavx512f.h: mkrename finz_ 8 16 avx512f
[454/1806] Generating include/renamecuda.h
Generating renamecuda.h: mkrename finz_ 1 1 cuda
[460/1806] Generating ../../../include/sleef.h
Generating sleef.h: mkrename cinz_ 2 4 __m128d __m128 __m128i __m128i __SSE2__
Generating sleef.h: mkrename cinz_ 2 4 __m128d __m128 __m128i __m128i __SSE2__ sse2
Generating sleef.h: mkrename cinz_ 2 4 __m128d __m128 __m128i __m128i __SSE2__ sse4
Generating sleef.h: mkrename cinz_ 4 8 __m256d __m256 __m128i struct\ {\ __m128i\ x,\ y;\ } __AVX__
Generating sleef.h: mkrename cinz_ 4 8 __m256d __m256 __m128i struct\ {\ __m128i\ x,\ y;\ } __AVX__ avx
Generating sleef.h: mkrename finz_ 4 8 __m256d __m256 __m128i struct\ {\ __m128i\ x,\ y;\ } __AVX__ fma4
Generating sleef.h: mkrename finz_ 4 8 __m256d __m256 __m128i __m256i __AVX__ avx2
Generating sleef.h: mkrename finz_ 2 4 __m128d __m128 __m128i __m128i __SSE2__ avx2128
Generating sleef.h: mkrename finz_ 8 16 __m512d __m512 __m256i __m512i __AVX512F__
Generating sleef.h: mkrename finz_ 8 16 __m512d __m512 __m256i __m512i __AVX512F__ avx512f
Generating sleef.h: mkrename cinz_ 8 16 __m512d __m512 __m256i __m512i __AVX512F__ avx512fnofma
Generating sleef.h: mkrename cinz_ 1 1 double float int32_t int32_t __STDC__ purec
Generating sleef.h: mkrename finz_ 1 1 double float int32_t int32_t FP_FAST_FMA purecfma
[510/1806] Generating ../../../torch/utils/data/datapipes/datapipe.pyi
Generating Python interface file 'datapipe.pyi'...
[522/1806] Building CXX object torch/c...e_dt_needed.dir/remove_dt_needed.cpp.o
FAILED: torch/csrc/deploy/CMakeFiles/remove_dt_needed.dir/remove_dt_needed.cpp.o 
ccache /Library/Developer/CommandLineTools/usr/bin/clang++ -DFMT_HEADER_ONLY=1 -DHAVE_MMAP=1 -DHAVE_SHM_OPEN=1 -DHAVE_SHM_UNLINK=1 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DUSE_EXTERNAL_MZCRC -D_FILE_OFFSET_BITS=64 -Iaten/src -I../aten/src -I. -I../ -I../third_party/onnx -Ithird_party/onnx -I../third_party/foxi -Ithird_party/foxi -I../third_party/fmt/include -isystem ../third_party/protobuf/src -isystem /Users/fenkexin/opt/anaconda3/include -isystem ../third_party/ittapi/include -isystem ../cmake/../third_party/eigen -Wno-deprecated -fvisibility-inlines-hidden -Wno-deprecated-declarations -DUSE_PTHREADPOOL -Xpreprocessor -fopenmp -I/Users/fenkexin/opt/anaconda3/include -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_PYTORCH_QNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-range-loop-analysis -Wno-pass-failed -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -Wconstant-conversion -Wno-invalid-partial-specialization -Wno-typedef-redefinition -Wno-unknown-warning-option -Wno-unused-private-field -Wno-inconsistent-missing-override -Wno-aligned-allocation-unavailable -Wno-c++14-extensions -Wno-constexpr-not-const -Wno-missing-braces -Qunused-arguments -fcolor-diagnostics -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -DUSE_MPS -fno-objc-arc -Wno-unused-private-field -Wno-missing-braces -Wno-c++14-extensions -Wno-constexpr-not-const -g -fno-omit-frame-pointer -O0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.9 -fPIE -DTH_HAVE_THREAD -std=gnu++14 -MD -MT torch/csrc/deploy/CMakeFiles/remove_dt_needed.dir/remove_dt_needed.cpp.o -MF torch/csrc/deploy/CMakeFiles/remove_dt_needed.dir/remove_dt_needed.cpp.o.d -o torch/csrc/deploy/CMakeFiles/remove_dt_needed.dir/remove_dt_needed.cpp.o -c ../torch/csrc/deploy/remove_dt_needed.cpp
../torch/csrc/deploy/remove_dt_needed.cpp:1:10: fatal error: 'elf.h' file not found
#include <elf.h>
         ^~~~~~~
1 error generated.
[536/1806] Generating ../../../torch/version.py
fatal: no tag exactly matches '8a6c104ce9398815989317f208eae80ea2fe6ac1'
[539/1806] Performing download step (git clone) for 'cpython'
Cloning into 'cpython'...
Note: switching to 'v3.8.6'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at db455296be Python 3.8.6
ninja: build stopped: subcommand failed.

Versions

Collecting environment information...
PyTorch version: 1.12.1
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.5 (x86_64)
GCC version: Could not collect
Clang version: 13.1.6 (clang-1316.0.21.2.5)
CMake version: version 3.19.6
Libc version: N/A

Python version: 3.9.12 (main, Jun 1 2022, 06:36:29) [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.19.2
[pip3] pytorch-lightning==1.6.5
[pip3] pytorch-metric-learning==1.3.2
[pip3] torch==1.12.1
[pip3] torchmetrics==0.7.3
[pip3] torchtext==0.13.0
[pip3] torchvision==0.13.1
[conda] blas 1.0 mkl
[conda] ffmpeg 4.3 h0a44026_0 pytorch
[conda] mkl 2019.4 233
[conda] mkl-include 2022.0.0 hecd8cb5_105
[conda] mkl-service 2.3.0 py39h9ed2024_0
[conda] mkl_fft 1.3.0 py39ha059aab_0
[conda] mkl_random 1.0.2 py39h16bde0e_0
[conda] numpy 1.19.2 py39he57783f_0
[conda] numpy-base 1.19.2 py39hde55871_0
[conda] pytorch 1.12.1 py3.9_0 pytorch
[conda] pytorch-lightning 1.6.5 pypi_0 pypi
[conda] pytorch-metric-learning 1.3.2 pypi_0 pypi
[conda] torch 1.13.0a0+git8a6c104 dev_0
[conda] torchmetrics 0.7.3 pypi_0 pypi
[conda] torchtext 0.13.0 pypi_0 pypi
[conda] torchvision 0.13.1 py39_cpu pytorch

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.