Runtime Error: Decorator script does not work dynamically compiled function
Maintainer thường phản hồi trong vòng 4 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- numpy, python
- Lĩnh vực
- developer-experience, tooling
Hướng nghiên cứu
Bắt đầu với onnxscript/_internal/ast_utils.py và onnxscript/main.py, tập trung vào get_src_and_ast và đường dẫn của decorator gây ra lỗi cho conv. Tái hiện ví dụ trong console được biên dịch động của PyCharm và trong .venv, sau đó xác định liệu decorator có thể hỗ trợ ngữ cảnh thực thi đó hay không; công việc được xem là hoàn tất khi hành vi được hỗ trợ hoặc giới hạn đã được xác lập rõ ràng và được bao phủ bởi một test hoặc tài liệu phù hợp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi everyone, I get the Runtime Error when running the function below in Poetry environment with Python 3.11 and Pycharm IDE. I was able to run it successfully from Virtual Environment (the .venv). Can someone offer help on how to fix it?
import numpy as np
import onnx
import onnxruntime
import pandas as pd
from onnxscript import FLOAT
from onnxscript import opset20 as op
x = np.array([1,2,3,4,5,6,7,8,9,10,11,12,13])
y = np.array(x[len(x) - 3: len(x)], dtype=np.float32)
z = np.array(x[len(x)-8: len(x)-3], dtype=np.float32)
x_coef = np.array([1.1, 1.5, 1.7, 1.9, 1.2, 3.1, 4.5, 5.2, 8.5, 9.0, 11.0]
y_coef = np.array([8.5, 9.0, 11.0])
z_coef = np.array([5,7,9,9,10,11])
t1 = len(x)
t2 = len(y)
t3 = len(z)
const_term = 2.37698
h1 = 1.5689
h2 = 1.799
@script()
def conv(a1: FLOAT, a2: FLOAT, a3: FLOAT, a4: FLOAT, a5: FLOAT) -> FLOAT:
const = op.Constant(value_float=const_term)
# Define constants
coeff1 = op.Constant(value_float=h1)
coeff2 = op.Constant(value_float=h2)
s = coeff1 * a1 + coeff2 * a2 - const
for inx in range(t1):
if a4 == x[inx]:
s = s + x_coef[inx]
for inx2 in range(t2):
if a5 == y[inx2]:
s = s + y_coef[inx2]
for inx3 in range(t3):
if a6 == z[inx3]:
s = s + z_coef[inx3]
return op.Exp(s)
Error Message
Traceback (most recent call last):
File "[File_path]/lib/python3.11/site-packages/onnxscript/_internal/ast_utils.py", line 18, in get_src_and_ast
src = inspect.getsource(func)
^^^^^^^^^^^^^^^^^^^^^^^
File "[file_path]/.asdf/python/3.11.9/lib/python3.11/inspect.py", line 1258, in getsource
lines, lnum = getsourcelines(object)
^^^^^^^^^^^^^^^^^^^^^^
File "[file_path]/.asdf/installs/python/3.11.9/lib/python3.11/inspect.py", line 1240, in getsourcelines
lines, lnum = findsource(object)
^^^^^^^^^^^^^^^^^^
File "[file_path]/.asdf/installs/python/3.11.9/lib/python3.11/inspect.py", line 1077, in findsource
raise OSError('could not get source code')
OSError: could not get source code
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevconsole.py", line 364, in runcode
coro = func()
^^^^^^
File "", line 1, in
File "", line 67, in [module_name]
File "[path]/lib/python3.11/site-packages/onnxscript/main.py", line 82, in transform
src, f_ast = ast_utils.get_src_and_ast(f)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[path]/lib/python3.11/site-packages/onnxscript/_internal/ast_utils.py", line 20, in get_src_and_ast
raise RuntimeError(
RuntimeError: Decorator script does not work on dynamically compiled function conv.
- Ngôn ngữ chính
- Python
- Star
- 457
- Fork
- 149
- Merge trung bình
- 3 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 23
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/onnxscript
-
`fuse_skip_rms_normalization` fuses a float16 residual into a norm whose scale is float32, which ONNX Runtime rejectsCó thể đã có người làm @justinchuby đã nhận 1 ngày trước. Đang mởmodule: optimizer
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
microsoft/onnxscript#3155 · 3 bình luận · 1 reaction · 2 người được giao ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Constant folding uses onnx's plain reference ops, never onnx.reference.ops_optimizedCó thể đã có người làm @todkarsant đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/onnxscript#3003 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
CI : Pin github actions to full commit SHACó thể đã có người làm @Aniketsy đã nhận 186 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
microsoft/onnxscript#2903 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
[torchlib] aten::upsample_linear1d.vec is not supportedCó thể đã có người làm @kyunggeunlee đã nhận 1 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
microsoft/onnxscript#3165 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Batch-transpose fusion into `FusedMatMul` sets `transBatchA` on inputs of different ranks, which ONNX Runtime can't computeCó thể đã có người làm @Syedmudassir1604 đã nhận 2 ngày trước. Đang mởmodule: optimizer
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
microsoft/onnxscript#3156 ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của microsoft/onnxscript
Issue tương tự
-
[BUG]: Compliance rules never see Unity Catalog views as viewsCó thể đã có người làm @wagnercsantos đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
databrickslabs/ontos#1348 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
`forum_pr_poster` action will always return `none` when checking for pre-existing feedback threads, even if a feedback thread already exists.Có thể đã có người làm @pgmzeta đã nhận hôm nay. Đang mởE-Verified P-Major
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
goonstation/goonstation#28259 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
woonstadrotterdam/monumenten#70 ·
Maintainer thường phản hồi trong vòng 15 ngày
-
binding:python bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
The Browser tab fails with a Wayland error when Open Terminal runs from a Wayland desktop sessionĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
open-webui/open-terminal#210 ·