deep-learning-with-pytorch / dlwpt-code

Code for the book Deep Learning with PyTorch by Eli Stevens, Luca Antiga, and Thomas Viehmann.

Home Page:https://www.manning.com/books/deep-learning-with-pytorch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prepcache in p2ch11 wrongly calls for sort_by argument

alphahmed opened this issue · comments

Running prepcach.py from p2ch11 leads to the following error:

2020-09-27 16:09:11,916 INFO     pid:12612 __main__:043:main Starting LunaPrepCacheApp, Namespace(batch_size=1024, num_workers=8)
2020-09-27 16:09:15,968 INFO     pid:12612 p2ch11.dsets_edited:170:__init__ <p2ch11.dsets_edited.LunaDataset object at 0x7f4bc2f4baf0>: 548723 training samples
Traceback (most recent call last):
  File "/home/ahmed/anaconda3/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/ahmed/anaconda3/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/HiSp-1/dlwpt/prepcache.py", line 62, in <module>
    LunaPrepCacheApp().main()
  File "/HiSp-1/dlwpt/prepcache.py", line 45, in main
    self.prep_dl = DataLoader(
TypeError: __init__() got an unexpected keyword argument 'sortby_str'

The sort_by is not an argument of Luna's model DataLoader.
Removing the argument leads to successful run, but the effect of having unsorted cache is unknown?!

So I've looked at https://github.com/deep-learning-with-pytorch/dlwpt-code/blob/master/p2ch11/dsets.py#L151-L157 and there's pretty clearly a sortby_str argument to LunaDataset, which is where the argument is being passed in: https://github.com/deep-learning-with-pytorch/dlwpt-code/blob/master/p2ch11/prepcache.py#L45-L48

Can you double check that you've not inadvertently made some edits to the prepcache script?