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
pytorch3d
Commits
7e12e0ed
Commit
7e12e0ed
authored
May 23, 2024
by
sangwz
Browse files
add das version and update README
parent
b614e663
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
15 deletions
+49
-15
README.md
README.md
+9
-13
setup.py
setup.py
+40
-2
No files found.
README.md
View file @
7e12e0ed
## 简介
**PyTorch3D**
是一个用于深度学习中处理
**3D数据**
的库。它提供了一系列功能,方便处理和操作三维数据
,
**PyTorch3D**
是一个用于深度学习中处理
**3D数据**
的库。它提供了一系列功能,方便处理和操作三维数据
。详细内容请查看
[
README_ORIGIN.md
](
README_ORIGIN.md
)
。
## 安装
组件支持:
*
Python 3.8,3.9 or 3.10
-
dtk-23.10
-
pytorch-2.1
### 1. pip安装
可以在
光合
[
光合开发者社区
](
https://developer.hpccube.com/tool/#sdk
)
AI 生态包中获取
最新的
`pytorch3d`
版本,注意应与DCU Toolkit版本
以及pytorch版本对应
可以在
[
光合开发者社区
](
https://developer.hpccube.com/tool/#sdk
)
AI 生态包中获取
`pytorch3d`
安装包,注意dtk
以及pytorch版本对应
。
```
shell
wget http://10.6.10.68:8000/customized/pytorch3d/23.10/pytorch3d-0.7.6-cp38-cp38-linux_x86_64.whl
python
-m
pip
install
pytorch3d-0.7.6-cp38-cp38-linux_x86_64.whl
python
-m
pip
install
pytorch3d
*
.whl
```
### 2. 源码编译安装
#### 环境准备
若未安装dtk、torch,可参考以下安装
*
在
[
开发者社区
](
https://developer.hpccube.com/tool/#sdk
)
DCU Toolkit 中下载 DTK-23.10 解压至 /opt/ 路径下,并建立软链接
*
在
[
光合
开发者社区
](
https://developer.hpccube.com/tool/#sdk
)
DCU Toolkit 中下载 DTK-23.10 解压至 /opt/ 路径下,并建立软链接
```
plaintext
cd /opt && ln -s dtk-23.10 dtk
```
*
在
光合
[
光合开发者社区
](
https://developer.hpccube.com/tool/#sdk
)
AI 生态包中获取对应的 pytorch-2.1版本(需对应 DCU Toolkit 版本)
*
在
[
光合开发者社区
](
https://developer.hpccube.com/tool/#sdk
)
AI 生态包中获取对应的 pytorch-2.1版本(需对应 DCU Toolkit 版本)
```
shell
cd
path/to/torch
...
...
@@ -46,16 +45,13 @@ python -m pip install pytorch3d-0.7.6-cp38-cp38-linux_x86_64.whl
#### 编译安装
*
拉取代码
```
shell
git clone http://developer.hpccube.com/codes/aicomponent/pytorch3d.git
#注意根据需要切换分支
```
*
若使用
`GPU`
支持,需要设置环境变量
`FORCE_CUDA`
为1
```
shell
export
FORCE_CUDA
=
1
# DCU环境下添加以下环境变量
export
HIPCC_COMPILE_FLAGS_APPEND
=
"--gpu-max-threads-per-block=1024"
```
-
执行编译命令
...
...
@@ -97,7 +93,7 @@ python -m pip install pytorch3d-0.7.6-cp38-cp38-linux_x86_64.whl
## 验证
*
python -c "import pytorch3d; pytorch3d.
\_\
_
version__
"
,版本号与官方版本同步,查询该软件的版本号。
*
`
python -c "import pytorch3d;
print(
pytorch3d.
_
_version__
)"`
,版本号与官方版本同步,查询该软件的版本号。
setup.py
View file @
7e12e0ed
...
...
@@ -128,7 +128,43 @@ def get_extensions():
# Retrieve __version__ from the package.
__version__
=
runpy
.
run_path
(
"pytorch3d/__init__.py"
)[
"__version__"
]
import
subprocess
def
get_abi
():
try
:
command
=
"echo '#include <string>' | gcc -x c++ -E -dM - | fgrep _GLIBCXX_USE_CXX11_ABI"
result
=
subprocess
.
run
(
command
,
shell
=
True
,
capture_output
=
True
,
text
=
True
)
output
=
result
.
stdout
.
strip
()
abi
=
"abi"
+
output
.
split
(
" "
)[
-
1
]
return
abi
except
Exception
:
return
'abiUnknown'
dcu_version
=
__version__
dcu_version
+=
'+das1.1'
sha
=
"Unknown"
cwd
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
try
:
sha
=
subprocess
.
check_output
([
"git"
,
"rev-parse"
,
"HEAD"
],
cwd
=
cwd
).
decode
(
"ascii"
).
strip
()
except
Exception
:
pass
if
sha
!=
'Unknown'
:
dcu_version
+=
'.git'
+
sha
[:
7
]
dcu_version
+=
"."
+
get_abi
()
if
os
.
getenv
(
"ROCM_PATH"
):
rocm_path
=
os
.
getenv
(
'ROCM_PATH'
,
""
)
rocm_version_path
=
os
.
path
.
join
(
rocm_path
,
'.info'
,
"rocm_version"
)
with
open
(
rocm_version_path
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
lines
=
file
.
readlines
()
rocm_version
=
lines
[
0
][:
-
2
].
replace
(
"."
,
""
)
dcu_version
+=
".dtk"
+
rocm_version
# torch version
import
torch
dcu_version
+=
".torch"
+
torch
.
__version__
[:]
def
write_version_file
():
cwd
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
version_path
=
os
.
path
.
join
(
cwd
,
"pytorch3d"
,
"__init__.py"
)
with
open
(
version_path
,
"a"
)
as
f
:
f
.
write
(
f
"
\n
__dcu_version__ = '
{
dcu_version
}
'"
)
if
os
.
getenv
(
"PYTORCH3D_NO_NINJA"
,
"0"
)
==
"1"
:
...
...
@@ -141,9 +177,11 @@ else:
trainer
=
"pytorch3d.implicitron_trainer"
write_version_file
()
setup
(
name
=
"pytorch3d"
,
version
=
_
_version
__
,
version
=
dcu
_version
,
author
=
"FAIR"
,
url
=
"https://github.com/facebookresearch/pytorch3d"
,
description
=
"PyTorch3D is FAIR's library of reusable components "
...
...
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