Pluto.jl
Pluto.jl copied to clipboard
Dataloder constructor is passed in the wrong order when called from within the flux.Data.
env (EDIT from fons, this is not the env, see the notebook file below):
(@v1.6) pkg> status
Status `~/.julia/environments/v1.6/Project.toml`
[fbb218c0] BSON v0.3.5
[052768ef] CUDA v3.8.3
[587475ba] Flux v0.12.9
[41a02a25] Folds v0.2.7
[7073ff75] IJulia v1.23.2
[c3e4b0f8] Pluto v0.18.1
code:
using Flux, Unicode,BSON,Folds,CUDA
data_valid = [("hello", "world"), ("yes", "I'm")]
begin
struct SentVct <: AbstractArray{Int, 1}
data::Array{Tuple{String, String}}
sublen ::UInt64
end
Base.getindex(d::SentVct, i::Int) = rand(d.sublen)
Base.getindex(d::SentVct, ii::Vector{Int}) = begin
reduce(hcat, [getindex(d, i) for i in ii])
end
Base.firstindex(d::SentVct) = 1
Base.lastindex(d::SentVct) = length(d.data)
Base.size(d::SentVct) = d.sublen, length(d.data)
Base.eltype(d::SentVct) = Vector{Int64}
Base.length(d::SentVct) = length(d.data)
# # dl_valid = Flux.Data.DataLoader(SentVct(data_valid, 7))
# # for d in dl_valid
# # @show typeof(d)
# # break
# # end
# for x in SentVct(data_valid, 7)
# @show x
# break
# end
Flux.Data.DataLoader(SentVct(data_valid, 7);)
end
error: """ MethodError: no method matching MLUtils.DataLoader(::Main.workspace#3.SentVct, ::Int64, ::UInt64, ::Bool, ::Bool, ::Random._GLOBAL_RNG)
Closest candidates are:
MLUtils.DataLoader(::D, ::Int64, !Matched::Int64, ::Bool, ::Bool, ::R) where {D, R<:Random.AbstractRNG} at /home/dataeye/.julia/packages/MLUtils/60cvs/src/dataloader.jl:4
MLUtils.DataLoader(::Any; batchsize, shuffle, partial, rng) at /home/dataeye/.julia/packages/MLUtils/60cvs/src/dataloader.jl:75
var"#DataLoader#63"(::Int64, ::Bool, ::Bool, ::Random._GLOBAL_RNG, ::Type{MLUtils.DataLoader}, ::Main.workspace#3.SentVct)@dataloader.jl:82
MLUtils.DataLoader(::Main.workspace#3.SentVct)@dataloader.jl:76
top-level scope@[Local: 24](http://0.0.0.0:1234/edit?id=cf6a0224-bc9f-11ec-27a9-edbfd9edca81#)
"""
This error disappeared out of Pluto.
Can you share a notebook file?