Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling - identify which block in which pipeline triggers an exception #128

Closed
markmc opened this issue Jul 12, 2024 · 2 comments · Fixed by #155
Closed

Error handling - identify which block in which pipeline triggers an exception #128

markmc opened this issue Jul 12, 2024 · 2 comments · Fixed by #155
Assignees
Milestone

Comments

@markmc
Copy link
Contributor

markmc commented Jul 12, 2024

See #118 for the background

In general, I think when there is an error with a block, we don't make it easy to know which block in which pipeline caused it

A config_path not found case looks like

  File "/home/markmc/sdg/src/instructlab/sdg/sdg.py", line 19, in generate
    dataset = pipeline.generate(dataset)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/markmc/sdg/src/instructlab/sdg/pipeline.py", line 57, in generate
    block = block_type(self.ctx, **block_config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/markmc/sdg/src/instructlab/sdg/llmblock.py", line 66, in __init__
    self.block_config = self._load_config(config_path)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/markmc/sdg/src/instructlab/sdg/block.py", line 54, in _load_config
    with open(config_path, "r", encoding="utf-8") as config_file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/markmc/sdg/src/instructlab/sdg/configs/skills/freeform_questions.yaml.foobar'

Which isn't so bad, because you just have to find the block with that path

But in other cases it might not be so easy to identify which block is causing an error - if we catch exceptions and add the pipeline+block name, that would be a big improvement

@gabe-l-hart
Copy link
Contributor

Per a pointer from @russellb, I'm going to take a look at this one today and will report my progress here. I don't have write access to assign to myself though.

gabe-l-hart added a commit to gabe-l-hart/instructlab-sdg that referenced this issue Jul 16, 2024
gabe-l-hart added a commit to gabe-l-hart/instructlab-sdg that referenced this issue Jul 16, 2024
@markmc
Copy link
Contributor Author

markmc commented Jul 17, 2024

In #155, @russellb asked for before/after examples for the fix. What's currently proposed is to catch exceptions from block.generate(), so here's an example of the current behavior:

INFO 2024-07-17 07:08:14,120 pipeline.py:77: generate Running block: gen_questions
INFO 2024-07-17 07:08:14,120 pipeline.py:78: generate Dataset({
    features: ['task_description', 'seed_question', 'seed_response'],
    num_rows: 5
})
...
  File "/home/markmc/sdg/src/instructlab/sdg/sdg.py", line 20, in generate
    dataset = pipeline.generate(dataset)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/markmc/sdg/src/instructlab/sdg/pipeline.py", line 80, in generate
    dataset = block.generate(dataset)
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/markmc/sdg/src/instructlab/sdg/llmblock.py", line 181, in generate
    raise Exception("TEST")
Exception: TEST

This case isn't actually so problematic because the context is logged - Running block: gen_questions

gabe-l-hart added a commit to gabe-l-hart/instructlab-sdg that referenced this issue Jul 17, 2024
gabe-l-hart added a commit to gabe-l-hart/instructlab-sdg that referenced this issue Jul 17, 2024
gabe-l-hart added a commit to gabe-l-hart/instructlab-sdg that referenced this issue Jul 17, 2024
jwm4 pushed a commit to jwm4/sdg that referenced this issue Dec 13, 2024
github: add stale bot to dev docs repo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants