Flux.jl icon indicating copy to clipboard operation
Flux.jl copied to clipboard

2020-09-15-deep-learning-flux tutorial crashes

Open pojeda opened this issue 2 years ago • 2 comments

Hi,

I tried the tutorial on this repo that is mentioned in the title. I am using Julia v. 1.8.5, and

[052768ef] CUDA v4.0.1 [587475ba] Flux v0.13.12 [eb30cadb] MLDatasets v0.7.9

ERROR: LoadError: Scalar indexing is disallowed. Invocation of getindex resulted in scalar indexing of a GPU array. This is typically caused by calling an iterating implementation of a method. Such implementations do not execute on the GPU, but very slowly on the CPU

According to the line numbers (in my file script), the issue seems to come from:

for i in 1:10 preds = m(test[i][1]) lab = test[i][2] for j = 1:1000 pred_class = findmax(preds[:, j])[2] actual_class = findmax(lab[:, j])[2] if pred_class == actual_class class_correct[pred_class] += 1 end class_total[actual_class] += 1
end
end

Besides this, I saw the warning: ┌ Warning: CIFAR10.testdata() is deprecated, use CIFAR10(split=:test)[:] instead.

/Pedro

pojeda avatar Feb 07 '23 11:02 pojeda

I presume you mean http://fluxml.ai/tutorialposts/2020-09-15-deep-learning-flux/ . Unfortunately tutorials there have been allowed to rot, and ought to be deleted.

Some have more recently updated cousins here: https://github.com/FluxML/model-zoo#examples-in-the-model-zoo . Those should all have project/manifest files, so that julia --project loads a known-good set of versions. The version of Flux is noted for each; the ones which say v0.13 will work on latest Flux as above (i.e. without using their own manifest). Ideally they would all be so updated, of course...

mcabbott avatar Feb 07 '23 13:02 mcabbott

I read about the license of Flux but I wanted to double check with you if it is fine if I take the example you wrote and copy/paste into some material I am developing for a course which will be publicly available?

pojeda avatar Feb 07 '23 14:02 pojeda