bytecodealliance / bytecodealliance/componentize-py
Pytorch support
- Ngôn ngữ chính
- Rust
- Star
- 277
- Fork
- 51
- Merge trung bình
- 12 giờ 10 phút
- Pull request đã merge (30 ngày)
- 10
Mô tả
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
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với lệnh biên dịch componentize-py 0.16.0 và strategy.py được cung cấp, sau đó tái hiện lỗi import trên Python 3.11.10 trên macOS. Truy vết lý do việc import torch đi tới ctypes mà không có _ctypes; hoàn thành khi module PyTorch được báo cáo có thể biên dịch thành công hoặc giới hạn được hỗ trợ và thiết lập bắt buộc được tài liệu hóa rõ ràng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python, pytorch, wasm
- Lĩnh vực
- build-system, machine-learning, tooling
- Loại issue
- Lỗi
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 20/100