The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

299125 (2) [Avatar] Offline
#1
Hi, the book seems to be shaping up nicely. I downloaded the latest code and the luna16 dataset that is publicly available. Next, I tried to run the chapter 10 code after laying out the directory structure as expected in the code. At first, I got a syntax error in dsets.py on line 606:
self.series_list.append(self.series_list.pop(0)) ring buffer

I fixed this by commenting out "ring buffer", but then got another syntax error on line 608 in dests.py where ndx is not defined. I fixed this error by changing the argument name from key to ndx for the __getitem__ function.

Then, I tried to run the training module by using all default arguments and then again by passing the "--segmentation" argument. Both the times, I got the following errors:

(base) C:\Users\XXX\projects\manning\bookcode-master\p2ch10>python training.py
Traceback (most recent call last):
File "training.py", line 571, in <module>
sys.exit(LunaTrainingApp().main() or 0)
File "training.py", line 134, in __init__
self.model = self.initModel()
File "training.py", line 145, in initModel
assert False
AssertionError

(base) C:\Users\XXX\projects\manning\bookcode-master\p2ch10>python training.py --segmentation
2018-12-16 05:03:19,511 INFO pid:5656 __main__:214:main Starting LunaTrainingApp, Namespace(adaptive=False, augmented=False, balanced=False, batch_size=4,
comment='none', epochs=1, multiscaled=False, num_workers=8, scaled=False, segmentation=True, tb_prefix='p2ch10')
Traceback (most recent call last):
File "training.py", line 571, in <module>
sys.exit(LunaTrainingApp().main() or 0)
File "training.py", line 216, in main
test_dl = self.initTestDl()
File "training.py", line 186, in initTestDl
contextSlices_count=3,
TypeError: __init__() got an unexpected keyword argument 'isTestSet_bool'

Please update the repo with the fixes and let me know how I can run it, so that I can try out the training and diagnose modules.

Thanks.
Eli Stevens (15) [Avatar] Offline
#2
Hi!

Thanks for letting us know about code issues. Unfortunately, chapter 10 is still in active development, so I don't have a version of the code that's meaningfully better that what you've got. I'm currently refactoring what used to be two separate training loops (one for classification, one for segmentation) into one unified training script that works for both (since I think that's more clear, given the huge amounts of duplicated code between the two), as well as splitting the Test and Train datasets into separate classes (since again, I think it's more clear than the spaghetti if blocks that were needed otherwise).

Aside from this, you should also be aware that at some point Luca is going to do a deeper code review of chapter 10, and so there might be more changes still to come there. Such is the danger of getting ahead of the MEAP releases! smilie

Have you run the chapter 9 code? That should be in better shape (though I should note that I haven't updated it for PyTorch 1.0 yet; should be okay?).

I'll make a note to myself to return to this thread and post an update when chapter 10 is in better shape. Given the holidays coming up, it might be a bit.

I'm curious, is the code easy enough to follow without the accompanying chapters? I'd hope so, but it's difficult to evaluate that on your own code. I'd love to know about anything that isn't easy to digest.

Cheers!
Eli
Eli Stevens (15) [Avatar] Offline
#3
FYI, I've just pushed an updated version of the code to GitHub. Training should now work for both classification and segmentation tasks, though I'm still experimenting with how to improve convergence on the segmentation side, and I need to verify that the changes I made to support segmentation haven't broken the classification loss calculation and/or logging (the numbers seem off, but a quick review of the code didn't result in any obvious bugs). In addition, the code hasn't been cleaned up much, so expect to see a lot of things commented out.

Please let us know if you have further questions or comments.

Thanks!