bytecodealliance / bytecodealliance/componentize-py
Pytorch support
- 主要语言
- Rust
- 星标
- 279
- 派生
- 52
- 平均合并
- 12 小时 10 分钟
- 30 天内合并 PR
- 10
描述
I introduced the pytorch module. When executing the compilation, the following error was reported. How should I solve this problem?
```
Building component my-server with `componentize-py -w spin-http componentize my_server -o target/app/my_server.wasm`
Traceback (most recent call last):
File "/Users/ken/Work/Workspace/spin/myenv/bin/componentize-py", line 8, in
sys.exit(script())
AssertionError: Traceback (most recent call last):
File "/0/my_server.py", line 4, in
from strategy import get_strategy_result
File "/0/strategy.py", line 1, in
from torch import tensor
File "/1/torch/__init__.py", line 14, in
import ctypes
File "/python/ctypes/__init__.py", line 8, in
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
```
the strategy.py is:
```
from torch import tensor
def get_strategy_result():
# Create a tensor
x = tensor([1.0, 2.0, 3.0])
# Perform a simple operation
y = x * 2
return y
if __name__ == "__main__":
print(get_strategy_result())
```
The version of componentize-py is 0.16.0
my plantform is MacBook Pro
the version of Python is 3.11.10
贡献指南
调研方向
先从 componentize-py 0.16.0 的编译命令和提供的 strategy.py 开始,然后在 macOS 上的 Python 3.11.10 中重现导入失败。追踪导入 torch 为何会在没有 _ctypes 的情况下到达 ctypes;当报告的 PyTorch 模块能够成功编译,或受支持的限制和所需设置已得到明确记录时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python, pytorch, wasm
- 领域
- build-system, machine-learning, tooling
- Issue 类型
- 缺陷
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 20/100