Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix examples/mnist/mnist*.py #400

Closed
wants to merge 1 commit into from
Closed

Conversation

ndronen
Copy link

@ndronen ndronen commented Jan 15, 2019

Fixes # 2

Description:

The scripts wouldn't even run because

  • Someone split Accuracy into BinaryAccuracy and CategoricalAccuracy without updating the client code!
  • On a machine with a GPU, the model wasn't being put to the device, but the inputs were.

Check list:

  • New tests are added (if a new feature is modified)
  • New doc strings: text and/or example code are in RST format
  • Documentation is updated (if required)

…o {Binary,Categorical}Accuracy and (2) to run properly on a GPU.
@vfdev-5
Copy link
Collaborator

vfdev-5 commented Jan 15, 2019

@ndronen thanks for the PR, however your assumption on

Someone split Accuracy into BinaryAccuracy and CategoricalAccuracy without updating the client code!

is wrong. Historically there were two accuracy classes BinaryAccuracy, CategoricalAccuracy which have been merged into a single one. Please, take a look at #275.

Probably, you experience versions problem between the example code from the master and some old library version. I just checked the mnist.py example in a fresh conda environment and on a pc with GPU:

git clone https://github.com/pytorch/ignite.git
cd ignite/example/mnist
pip install torch torchvision tqdm numpy pytorch-ignite
python mnist.py
Downloading http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz
Downloading http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz
Downloading http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz
Downloading http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz
Processing...
Done!
Training Results - Epoch: 1  Avg accuracy: 0.94 Avg loss: 0.22
Validation Results - Epoch: 1  Avg accuracy: 0.94 Avg loss: 0.20
ITERATION - loss: 0.24:  99%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 930/938 [00:23<00:00, 122.01it/s]

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Jan 15, 2019

I'll close this PR as proposed modifications are not correct. Please create an issue if you still experience any problem with running mnist examples

@vfdev-5 vfdev-5 closed this Jan 15, 2019
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants