continue_run = 1 dies with "an unknown error" on every sampler but am, and on am with no earlier run, after -o has already replaced Results/

Đang mở Phù hợp với người mới
#1,071 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
85/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend, testing

Hướng nghiên cứu

Bắt đầu với Configuration.check_fresh_run() và cách xử lý continue_run trong pybnf/algorithms/samplers/base.py:506; đọc khóa được ghi tài liệu trong docs/config_keys.rst và logic ghi tệp trong pybnf/algorithms/samplers/adaptive_mcmc.py. Thêm các bước kiểm tra trước khi chạm đến thư mục đầu ra, sau đó dùng kiểm thử để bao phủ cả hai trường hợp từ chối: sampler không phải am và am không có adaptive_files/MLE_params.txt. Hoàn tất khi các trường hợp đó thất bại rõ ràng mà không thay thế đầu ra hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

continue_run = 1 starts every chain from adaptive_files/MLE_params.txt, a file only am writes (pybnf/algorithms/samplers/adaptive_mcmc.py). The key is documented under "For Adaptive MCMC" in docs/config_keys.rst. But the sampler base class applies it to every sampler (pybnf/algorithms/samplers/base.py:506), and nothing checks for the file before the run starts. So:

  • On dream, p_dream, mh, pt or hmc, continue_run = 1 can never work.
  • On am, it fails whenever there is no earlier am run in output_dir.

Either way the run dies with "Sorry, an unknown error occurred: FileNotFoundError: out/adaptive_files/MLE_params.txt not found ... Please report this bug". With -o, the earlier run's Results/ has already been replaced by then, so the user loses that output and gets a crash in return.

Found while reviewing #1066. Reproduced on main at cbb8159c.

Reproduction
  1. Run this dream conf with pybnf -c x.conf -o. It finishes and leaves out/Results/ with samples.txt and the credible intervals.

    edition = 2
    objective = gaussian, mean = 0 0, variance = 1 1
    uniform_var = g1 -10 10
    uniform_var = g2 -10 10
    random_seed = 1
    output_dir = out
    job_type = dream
    population_size = 4
    max_iterations = 50
    burn_in = 10
    sample_every = 1
    
  2. Add continue_run = 1 and run pybnf -c x.conf -o again. It exits 1 with the FileNotFoundError above, asking the user to report a bug. out/Results/ now holds only x.conf and an empty sorted_params_end.txt.

What should happen

Check this at start, in Configuration.check_fresh_run(), before the output directory is touched:

  • refuse continue_run = 1 on any sampler other than am, saying that only am writes the files it reads;
  • on am, refuse it when adaptive_files/MLE_params.txt is missing, naming the file.

Each refusal needs a test. Related: #1044, about what continue_run does with the file's contents when it does exist.

Ngôn ngữ chính
Python
Star
26
Fork
25
Merge trung bình
4 giờ 25 phút
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của lanl/PyBNF

Tất cả issue của lanl/PyBNF

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.