-
Notifications
You must be signed in to change notification settings - Fork 83
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
Cannot get mnist example working #91
Comments
It seems that those CSV files on Kaggle contain an extra (and patently silly) “header” line
This needs to be stripped before the parser can do its work; can be done with diff --git a/examples/main/mnist.hs b/examples/main/mnist.hs
index 28be8cd..8805c8c 100644
--- a/examples/main/mnist.hs
+++ b/examples/main/mnist.hs
@@ -110,7 +110,7 @@ main = do
readMNIST :: FilePath -> ExceptT String IO [(S ('D2 28 28), S ('D1 10))]
readMNIST mnist = ExceptT $ do
mnistdata <- T.readFile mnist
- return $ traverse (A.parseOnly parseMNIST) (T.lines mnistdata)
+ return $ traverse (A.parseOnly parseMNIST) (tail $ T.lines mnistdata)
parseMNIST :: A.Parser (S ('D2 28 28), S ('D1 10))
parseMNIST = do Not sure if that's really sufficient to get it working though... for me, the process runs out of memory... |
Yeah, it does seem to work now – when I reduce the size of the datasets, it starts and improves accuracy during the training. Unfortunately, it doesn't run in constant memory, which is a big problem (but another issue). |
Fortunately, the memory leak actually seems to be specific to the Inception-style layers. With the simpler model from the README, it runs seemingly in constant space. Nice! |
Header lines are a common feature for CSV fines and they are not silly. |
@erikd I don't mean the fact that there is a header, but the |
Anyway... this issue has apparently been amply addressed with #97. I'll do some cherry-picking there and maybe try to submit that in form of usable PRs... |
I am trying to get the mnist example working.
I have got all the tests passing and am using data downloaded from kaggle.
The output when I run it:
stack runghc examples/main/mnist.hs data/train.csv data/test.csv
Training convolutional neural network...
Failed reading: takeWhile1
Have I got the right dataset? Am I just missing something or just being stupid?
The text was updated successfully, but these errors were encountered: