alibaba / alibaba/Alink

请问怎么在离线环境的Alink里面安装libtorch的库?

Open
#239 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.6k
Forks
780
PR merge metrics
No merged PRs in 30d

Description

我现在在使用alink推理torch模型(内网环境,无法连接互联网),模型和数据文件已经手动下载到本地,代码使用的官方文档的代码,如下:
test = AkSourceBatchOp()\
.setFilePath("./mnist_test_vector.ak");

test = VectorToTensorBatchOp()\
.setTensorDataType("float")\
.setTensorShape([1, 1, 28, 28])\
.setSelectedCol("vec")\
.setOutputCol("tensor")\
.setReservedCols(["label"])\
.linkFrom(test)

predictor = TorchModelPredictBatchOp()\
.setModelPath("./mnist_model_pytorch.pt")\
.setSelectedCols(["tensor"])\
.setOutputSchemaStr("probabilities FLOAT_TENSOR")

test = predictor.linkFrom(test).select("label, probabilities")
test.print()
但是推理时报错了,从代码里看,是需要连接互联网下载libtorch的推理库(cpu版)然后进行解压。我现在开发是在内网环境不能连接互联网,于是手动下载了libtorch的zip包,应该解压到什么路径?使用时是否需要修改什么参数选项避免连接互联网的步骤?
另外,如果要使用GPU进行推理,libtorch的安装和代码是否需要进行修改?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the TorchModelPredictBatchOp implementation and its documentation to trace how the CPU libtorch package is downloaded and unpacked. Document the supported offline installation path and parameters, and clarify whether GPU inference requires different libtorch files or code changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devops, machine-learning
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.