UnsupSeg icon indicating copy to clipboard operation
UnsupSeg copied to clipboard

Can't run predict: doesn't seem to load peak detection parameters from pickle anymore

Open yeswecan opened this issue 10 months ago • 0 comments

Here's the error inside dill:

Exception has occurred: TypeError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
a bytes-like object is required, not '_io.BytesIO'
  File "/home/k4/Projects/JingleGenerator/UnsupSeg/.venv/lib/python3.10/site-packages/dill/_dill.py", line 302, in loads
    file = StringIO(str)
  File "/home/k4/Projects/JingleGenerator/UnsupSeg/predict.py", line 23, in main
    peak_detection_params = dill.loads(io.BytesIO(ckpt['peak_detection_params']))['cpc_1']
  File "/home/k4/Projects/JingleGenerator/UnsupSeg/predict.py", line 55, in <module>
    main(args.wav, args.ckpt, args.prominence)
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main (Current frame)
    return _run_code(code, main_globals, None,
TypeError: a bytes-like object is required, not '_io.BytesIO'

Caused by the line

peak_detection_params = dill.loads(io.BytesIO(ckpt['peak_detection_params']))['cpc_1']

I think I got somewhere further fixing this by adding .read to io.BytesIO(ckpt['peak_detection_params']), but it still gives a different error unpickling the same file. Maybe the version of something has changed, but I tried both setting it up via requirements and changing versions of some of the components.

yeswecan avatar Apr 07 '24 19:04 yeswecan