biobootloader / wolverine

MIT License
5.21k stars 759 forks source link

Suggestion: add pysnooper.snoop decorator to add failing function's variables' types/values/updates to error message context #1

Open mlaugharn opened 1 year ago

mlaugharn commented 1 year ago

pysnooper.snoop() is a decorator that helps automate printf style debugging: example

import pysnooper

@pysnooper.snoop()
def number_to_bits(number):
    if number:
        bits = []
        while number:
            number, remainder = divmod(number, 2)
            bits.insert(0, remainder)
        return bits
    else:
        return [0]

number_to_bits(6)

example

I think this will help focus/improve GPT-4's debugging ability - https://github.com/cool-RR/PySnooper

There's also torchsnooper for even better snoop insight into pytorch

Tes-star commented 1 year ago

Cool idea. As it increases the number of tokens it increases costs and reduces the maximal length of processed code as far as I know. Could be an additional option.

AswanthManoj commented 1 year ago

Does vectorizing the Python code make it easier for the LLM to understand the syntax and semantics of the code, and potentially provide better suggestions for error fixes?

biobootloader commented 1 year ago

thanks for the tip, I will look into PySnooper!

biobootloader commented 1 year ago

Does vectorizing the Python code make it easier for the LLM to understand the syntax and semantics of the code, and potentially provide better suggestions for error fixes?

GPT-4 is pretty good at understanding syntax, loops, etc. It's possible it could help, feel free to experiment and let us know!

jakob1379 commented 1 year ago

I mean, you could simply cut out the first row with timestamps to reduce the number of token. But I would suggest making a test in all 3 cases to compare the performance