Part 1 notebooks in PyTorch

Thanks for sharing. Anything like this for Python?

Awesome. I was just about to do this myself, but thought that it would be best to search the forums if someone had tried it already :slight_smile:

fwiw I’ve just worked through Part 1 in PyTorch too (after doing most of it in Keras a few months ago) — my process was to try my best to do everything myself and then referenced @recastrodiaz’s notebooks when necessary. I feel like I have a muuuch better intuition for everything doing it this way,

I’m having a terrible time working with torchsample’s Trainer (even @recastrodiaz’s branch) so I’m just using my own training helpers — can’t wait for the ecosystem to stabilize and produce something solid (cc @jeremy ;))

Hi Rodrigo

I have exactly the same problem as ysaz

I use Windows, Anaconda, python 3.6.3
I use torchsample from your “losses” branch:
pip install git+https://github.com/recastrodiaz/torchsample.git@losses

Then in jupyter notebook, there’s a mistake:
trainer = getTrainer()
trainer.fit_loader(train_loader, val_loader=train_loader, nb_epoch=3)

of course, val_loader is not train_loader

i have the same problem as ysaz
but if i remove : trainer.set_metrics([CategoricalAccuracy()]) line
Then the error is:


AttributeError Traceback (most recent call last)
in ()
1 trainer = getTrainer(lr=1e-3)
2
----> 3 trainer.fit_loader(train_loader, val_loader=train_loader, num_epoch=3)
4 # This gets a validation accuracy of 98.9 when using the whole dataset

~\AppData\Local\Continuum\anaconda3\envs\Pytorch\lib\site-packages\torchsample\modules\module_trainer.py in fit_loader(self, loader, val_loader, num_epoch, cuda_device, verbose)
386
387 batch_logs[‘loss’] = loss.data[0]
–> 388 callback_container.on_batch_end(batch_idx, batch_logs)
389
390 if has_val_data:

~\AppData\Local\Continuum\anaconda3\envs\Pytorch\lib\site-packages\torchsample\callbacks.py in on_batch_end(self, batch, logs)
65 logs = logs or {}
66 for callback in self.callbacks:
—> 67 callback.on_batch_end(batch, logs)
68
69 def on_train_begin(self, logs=None):

~\AppData\Local\Continuum\anaconda3\envs\Pytorch\lib\site-packages\torchsample\callbacks.py in on_batch_end(self, batch, logs)
162
163 def on_batch_end(self, batch, logs=None):
–> 164 log_data = {key: ‘%.04f’ % value for key, value in self.trainer.history.batch_metrics.items()}
165 for k, v in logs.items():
166 if k.endswith(‘metric’):

AttributeError: ‘ModuleTrainer’ object has no attribute ‘history’

Hi @recastrodiaz, I am using conda and created an env for my code. How should I install torchsample ? I cloned the repo then did the pip install -e . method. It showed 'successfully installed` but I still can not import it…

Hi,
I have a problem when installing torchsample.

Indeed, an error message tells that i cannot unpack file…

I use anaconda for windows…

Thank you for any help