diagnose: the error argument is sent as epsilon; the output directory is never removed
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 62/100
Hướng nghiên cứu
Lỗi nằm trong cmdstanpy/model.py, tại CmdStanModel.diagnose: nhánh error nối thêm epsilon= thay vì error=, và thư mục đầu ra được tạo bằng tempfile.mkdtemp dưới _TMPDIR không bao giờ bị xóa. Hãy bắt đầu bằng việc đọc các kiểm thử của log_prob, vốn kiểm tra lệnh đã ghi log và là mẫu cho một kiểm thử mới. Công việc được coi là hoàn thành khi lệnh chứa error= và số mục trong _TMPDIR không đổi sau các lần gọi trên cả đường thành công lẫn đường thất bại. Hãy kiểm tra #869 trước, vì issue nói rằng cách dọn dẹp đã được thống nhất ở đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
CmdStanModel.diagnose (cmdstanpy develop at the time of writing, also 1.3.0) has two bugs:
- The
errorargument is sent asepsilon. CmdStan never receiveserror=, and when both arguments are given,epsilonappears twice on the command line. - Each call leaves a temporary output directory under
_TMPDIR, removed only at interpreter exit. This is the same pattern as #867, which is being fixed forlog_probin #869.
Where
cmdstanpy/model.py, CmdStanModel.diagnose, on develop:
if epsilon is not None:
cmd.append(f"epsilon={epsilon}")
if error is not None:
cmd.append(f"epsilon={error}") # should be f"error={error}"
...
output_dir = tempfile.mkdtemp(prefix=self.name, dir=_TMPDIR) # never removed
CmdStan 2.40.0's argument tree accepts both sub-arguments under diagnose test=gradient (output of <model> diagnose help-all):
gradient
Valid subarguments: epsilon, error
epsilon=<double> Finite difference step size Defaults to 1e-6
error=<double> Error threshold Defaults to 1e-6
Effect
diagnose(error=x)silently sets the finite-difference step to x, and the error threshold stays at its default 1e-6. The gradient check then judges against a threshold the caller did not ask for, using a step size the caller did not ask for.diagnose(epsilon=a, error=b)passesepsilon=a epsilon=b.- The output directory accumulates in long-running processes, as described in #867.
Suggested fix
- Send
f"error={error}". - Scope the output directory with
tempfile.TemporaryDirectory(prefix=self.name, dir=_TMPDIR), the approach agreed on #869. - Add a test asserting that the command carries
error=(the logged command, as thelog_probtests do) and that_TMPDIR's entry count is unchanged after calls on both the success path and the failure path.
We can fold this into #869, or open a separate PR, whichever you prefer.
Versions
cmdstanpy develop (also 1.3.0), CmdStan 2.40.0, Python 3.12, Linux x86_64.
- Ngôn ngữ chính
- Python
- Star
- 198
- Fork
- 81
- Merge trung bình
- 6 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- 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 stan-dev/cmdstanpy
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
laplace_sample: expose CmdStan's diagnostic_file (the Hessian at the mode)Có thể đã có người làm @atarutin đã nhận hôm nay. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
-
log_prob leaves a temporary output directory per call until interpreter exitCó thể đã có người làm @atarutin đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 22/100
-
Release 2.0Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
-
feature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Tất cả issue của stan-dev/cmdstanpy
Issue tương tự
-
Độ 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
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Multi-day events show "Ended" while still in progressCó thể đã có người làm @tarunagnihotri534 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
data-umbrella/du-event-board#231 · 2 bình luận ·
-
avl_automation: the generated control surface block isn't valid XML (typo in avl_out_parse.py)Có thể đã có người làm @brksol đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
PX4/PX4-gazebo-models#164 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
qiskit-community/qiskit-metal#1203 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày