modAL-python / modAL

A modular active learning framework for Python
https://modAL-python.github.io/
MIT License
2.23k stars 324 forks source link

Pytorch runnable example #44

Closed damienlancry closed 5 years ago

damienlancry commented 5 years ago

this is a runnable example of modAL using pytorch models, wrapped with skorch. this example is very similar to the one we can find in modAL/examples/keras_integration.py

codecov-io commented 5 years ago

Codecov Report

Merging #44 into dev will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev      #44      +/-   ##
==========================================
+ Coverage   97.16%   97.17%   +<.01%     
==========================================
  Files          31       31              
  Lines        1625     1628       +3     
==========================================
+ Hits         1579     1582       +3     
  Misses         46       46
Impacted Files Coverage Δ
modAL/utils/data.py 93.75% <100%> (+1.44%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fc8e2e0...57ce832. Read the comment docs.

cosmic-cortex commented 5 years ago

Thanks! I'll review the PR as soon as possible!

cosmic-cortex commented 5 years ago

I have reviewed it, everything works well! Currently, I am working on replacing the MNIST dataset using torchvision instead of Keras. This would be better for consistency. To do this, I also need to extend the modAL.utils.data_vstack function, since it does not support PyTorch tensors currently.

cosmic-cortex commented 5 years ago

I have finished the changes I mentioned. Planning to add a corresponding Jupyter notebook soon!

damienlancry commented 5 years ago

I could try to write the corresponding notebook if you want

cosmic-cortex commented 5 years ago

Ok, feel free to work on it! I will also get to it soon!

damienlancry commented 5 years ago

I have finished the changes I mentioned. Planning to add a corresponding Jupyter notebook soon!

When i run python pytorch_integration.py after pulling your changes i get TypeError: <class 'torch.Tensor'> datatype is not supported

Edit: oh no, my bad, it works just fine

damienlancry commented 5 years ago

i just pushed a jupyter notebook 100 percent similar to Keras_integration.ipynb

cosmic-cortex commented 5 years ago

I have added the notebook to the documentation and merged the PR. Thanks for your work! :)