We have several offline machines and want to deploy pytorch on them. To do this, We need to build a wheel package containing all dependencies (just like the official wheel package) in one machine and install the built .whl file in others. The result is:
(1) A  .whl file is built in one machine and successfully installed on  another one
(2) In the second machine, It takes a long time (about 3 minutes) in the procedure “lambda t, t.to_cuda()”. It’s a process to  transform the parameters of module to cuda tensors.  We guess the reason is the cuda dependencies isn’t correctly contained or used.
Our building script similar to https://github.com/pytorch/builder/blob/master/manywheel/build.sh. We can’t directly use it since our system is ubuntu and the machines are all offline.  Our own script has the same building precedure: Set the enviroment variables just like that in build.sh (line 5 to 11) —>  use “python setup.py bdist_wheel” to build -----> copy the dependencies into the wheel file (build_common.sh line 77 to 190. The build_common.sh is called in the end of build.sh).  Our python version is 3.6.2 and cuda version is 9.0.
We hope someone to help us, or just share your experience in building a “manywheel” file.  Thank you!

The problem came from the mismatch of CUDA version, just like ptrblck mentioned. We made a mistake when we wrote our own building script.  Additionaly, we have confirmed that the script https://github.com/pytorch/builder/blob/master/manywheel/build.sh can be used to build a wheel containing dependencies.