Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
1b673fd2
Unverified
Commit
1b673fd2
authored
Aug 05, 2019
by
Edward Z. Yang
Committed by
GitHub
Aug 05, 2019
Browse files
Updated wheel packaging for building nightlies. (#1197)
Signed-off-by:
Edward Z. Yang
<
ezyang@fb.com
>
parent
6a834e98
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
11 deletions
+50
-11
packaging/wheel/linux_manywheel.sh
packaging/wheel/linux_manywheel.sh
+37
-7
setup.py
setup.py
+13
-4
No files found.
packaging/wheel/linux_manywheel.sh
View file @
1b673fd2
#!/bin/bash
set
-ex
if
[
"$#"
-ne
1
]
;
then
echo
"Illegal number of parameters. Pass cuda version"
echo
"CUDA version should be cu9
0
, cu100 or cpu"
echo
"CUDA version should be cu9
2
, cu100 or cpu"
exit
1
fi
export
CUVER
=
"
$1
"
# cu90 cu100 cpu
export
CUVER
=
"
$1
"
# cu92 cu100 cpu
if
[[
"
$CUVER
"
==
"cu100"
]]
;
then
cu_suffix
=
""
else
cu_suffix
=
"+
$CUVER
"
fi
export
TORCHVISION_BUILD_VERSION
=
"0.
3
.0"
export
TORCHVISION_BUILD_VERSION
=
"0.
4
.0
.dev
$(
date
"+%Y%m%d"
)
${
cu_suffix
}
"
export
TORCHVISION_BUILD_NUMBER
=
"1"
export
TORCHVISION_LOCAL_VERSION_LABEL
=
"
$CUVER
"
export
OUT_DIR
=
"/remote/
$CUVER
"
export
TORCH_WHEEL
=
"torch -f https://download.pytorch.org/whl/
$CUVER
/stable.html --no-index"
pushd
/opt/python
DESIRED_PYTHON
=(
*
/
)
...
...
@@ -18,12 +27,33 @@ for desired_py in "${DESIRED_PYTHON[@]}"; do
done
OLD_PATH
=
$PATH
git clone https://github.com/pytorch/vision
-b
v
${
TORCHVISION_BUILD_VERSION
}
pushd
vision
cd
/tmp
rm
-rf
vision
git clone https://github.com/pytorch/vision
cd
/tmp/vision
for
PYDIR
in
"
${
python_installations
[@]
}
"
;
do
export
PATH
=
$PYDIR
/bin:
$OLD_PATH
pip
install
--upgrade
pip
pip
install
numpy pyyaml future
pip
install
$TORCH_WHEEL
pip uninstall
-y
torch
||
true
pip uninstall
-y
torch_nightly
||
true
export
TORCHVISION_PYTORCH_DEPENDENCY_NAME
=
torch_nightly
pip
install
torch_nightly
-f
https://download.pytorch.org/whl/nightly/
$CUVER
/torch_nightly.html
# CPU/CUDA variants of PyTorch have ABI compatible PyTorch for
# the CPU only bits. Therefore, we
# strip off the local package qualifier, but ONLY if we're
# doing a CPU build.
if
[[
"
$CUVER
"
==
"cpu"
]]
;
then
export
TORCHVISION_PYTORCH_DEPENDENCY_VERSION
=
"
$(
pip show torch_nightly |
grep
^Version: |
sed
's/Version: \+//'
|
sed
's/+.\+//'
)
"
else
export
TORCHVISION_PYTORCH_DEPENDENCY_VERSION
=
"
$(
pip show torch_nightly |
grep
^Version: |
sed
's/Version: \+//'
)
"
fi
echo
"Building against
${
TORCHVISION_PYTORCH_DEPENDENCY_VERSION
}
"
pip
install
ninja
python setup.py clean
python setup.py bdist_wheel
...
...
setup.py
View file @
1b673fd2
...
...
@@ -29,7 +29,7 @@ def get_dist(pkgname):
return
None
version
=
'0.
3
.0a0'
version
=
'0.
4
.0a0'
sha
=
'Unknown'
package_name
=
os
.
getenv
(
'TORCHVISION_PACKAGE_NAME'
,
'torchvision'
)
...
...
@@ -43,9 +43,13 @@ except Exception:
if
os
.
getenv
(
'TORCHVISION_BUILD_VERSION'
):
assert
os
.
getenv
(
'TORCHVISION_BUILD_NUMBER'
)
is
not
None
build_number
=
int
(
os
.
getenv
(
'TORCHVISION_BUILD_NUMBER'
))
version
=
os
.
getenv
(
'TORCHVISION_BUILD_VERSION'
)
base_version
=
os
.
getenv
(
'TORCHVISION_BUILD_VERSION'
)
version
=
base_version
if
build_number
>
1
:
version
+=
'.post'
+
str
(
build_number
)
local_label
=
os
.
getenv
(
'TORCHVISION_LOCAL_VERSION_LABEL'
)
if
local_label
is
not
None
:
version
+=
'+'
+
local_label
elif
sha
!=
'Unknown'
:
version
+=
'+'
+
sha
[:
7
]
print
(
"Building wheel {}-{}"
.
format
(
package_name
,
version
))
...
...
@@ -65,12 +69,17 @@ write_version_file()
readme
=
open
(
'README.rst'
).
read
()
pytorch_package_name
=
os
.
getenv
(
'TORCHVISION_PYTORCH_DEPENDENCY_NAME'
,
'torch'
)
pytorch_dep
=
os
.
getenv
(
'TORCHVISION_PYTORCH_DEPENDENCY_NAME'
,
'torch'
)
if
os
.
getenv
(
'TORCHVISION_PYTORCH_DEPENDENCY_VERSION'
):
pytorch_dep
+=
"=="
+
os
.
getenv
(
'TORCHVISION_PYTORCH_DEPENDENCY_VERSION'
)
# torchvision has CUDA bits, thus, we must specify a local dependency
if
local_label
is
not
None
:
pytorch_dep
+=
'+'
+
local_label
requirements
=
[
'numpy'
,
'six'
,
pytorch_
package_name
,
pytorch_
dep
,
]
pillow_ver
=
' >= 4.1.1'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment