第一次使用Flux.jl时遇到的问题

第一次使用Flux.jl时遇到的问题:

Warning: NNPACK not available for your platform: Windows(x86_64-w64-mingw32-libgfortran5-cxx11) 
│         You will be able to use only the default Julia NNlib backend
└ @ NNlib C:\Users\18810\.julia\packages\NNlib\sSn9M\src\NNlib.jl:14

test Flux
Testing Flux
Status `C:\Users\18810\AppData\Local\Temp\jl_NpmgdV\Manifest.toml`
  [621f4979] AbstractFFTs v0.5.0
  [1520ce14] AbstractTrees v0.3.3
  [79e6a3ab] Adapt v2.0.2
  [4c555306] ArrayLayouts v0.3.7
  [b99e7846] BinaryProvider v0.5.10
  [fa961155] CEnum v0.4.1
  [052768ef] CUDA v1.2.0
  [082447d4] ChainRules v0.7.12
  [d360d2e6] ChainRulesCore v0.9.4
  [944b1d66] CodecZlib v0.7.0
  [3da002f7] ColorTypes v0.10.6
  [5ae59095] Colors v0.12.3
  [bbf7d656] CommonSubexpressions v0.3.0
  [e66e0078] CompilerSupportLibraries_jll v0.3.3+0
  [adafc99b] CpuId v0.2.2
  [9a962f9c] DataAPI v1.3.0
  [864edb3b] DataStructures v0.17.19
  [163ba53b] DiffResults v1.0.2
  [b552c78f] DiffRules v1.0.1
  [ffbed154] DocStringExtensions v0.8.2
  [e30172f5] Documenter v0.25.1
  [e2ba6199] ExprTools v0.1.1
  [1a297f60] FillArrays v0.8.13
  [53c48c17] FixedPointNumbers v0.8.3
  [587475ba] Flux v0.11.0
  [f6369f11] ForwardDiff v0.10.12
  [d9f16b24] Functors v0.1.0
  [0c68f7d7] GPUArrays v4.0.1
  [61eb1bfa] GPUCompiler v0.5.3
  [7869d1d1] IRTools v0.4.0
  [c8e1da08] IterTools v1.3.0
  [682c06a0] JSON v0.21.0
  [e5e0dc1b] Juno v0.8.2
  [929cbde3] LLVM v2.0.0
  [bdcacae8] LoopVectorization v0.8.19
  [1914dd2f] MacroTools v0.5.5
  [e89f7d12] Media v0.5.0
  [e1d29d7a] Missings v0.4.3
  [46d2c3a1] MuladdMacro v0.2.2
  [a6bfbf70] NNPACK_jll v2018.6.22+0
  [872c559c] NNlib v0.7.3
  [77ba4419] NaNMath v0.3.4
  [6fe1bfb0] OffsetArrays v1.1.1
  [efe28fd5] OpenSpecFun_jll v0.5.3+3
  [bac558e1] OrderedCollections v1.3.0
  [69de0a69] Parsers v1.0.7
  [189a3867] Reexport v0.2.0
  [ae029012] Requires v1.0.1
  [21efa798] SIMDPirates v0.8.16
  [476501e8] SLEEFPirates v0.5.5
  [a2af1166] SortingAlgorithms v0.3.1
  [276daf66] SpecialFunctions v0.10.3
  [90137ffa] StaticArrays v0.12.4
  [2913bbd2] StatsBase v0.33.0
  [a759f4b9] TimerOutputs v0.5.6
  [3bb67fe8] TranscodingStreams v0.9.5
  [3a884ed6] UnPack v1.0.1
  [3d5dd08c] VectorizationBase v0.12.24
  [a5390f91] ZipFile v0.9.2
  [83775a58] Zlib_jll v1.2.11+14
  [e88e6eb3] Zygote v0.5.3
  [700de1a5] ZygoteRules v0.2.0
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8bb1440f] DelimitedFiles
  [8ba89e20] Distributed
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [44cfe95a] Pkg
  [de0858da] Printf
  [9abbd945] Profile
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA
  [9e88b42a] Serialization
  [6462fe0b] Sockets
  [2f01184e] SparseArrays
  [10745b16] Statistics
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
ERROR: LoadError: InitError: AssertionError: isfile(__libcupti[])
Stacktrace:
 [1] use_artifact_cuda() at C:\Users\18810\.julia\packages\CUDA\h38pe\deps\bindeps.jl:157
 [2] __init_dependencies__() at C:\Users\18810\.julia\packages\CUDA\h38pe\deps\bindeps.jl:314     
 [3] __runtime_init__() at C:\Users\18810\.julia\packages\CUDA\h38pe\src\initialization.jl:112    
 [4] (::CUDA.var"#609#610"{Bool})() at C:\Users\18810\.julia\packages\CUDA\h38pe\src\initialization.jl:32
 [5] lock(::CUDA.var"#609#610"{Bool}, ::ReentrantLock) at .\lock.jl:161
 [6] _functional(::Bool) at C:\Users\18810\.julia\packages\CUDA\h38pe\src\initialization.jl:26    
 [7] functional(::Bool) at C:\Users\18810\.julia\packages\CUDA\h38pe\src\initialization.jl:19     
 [8] functional at C:\Users\18810\.julia\packages\CUDA\h38pe\src\initialization.jl:18 [inlined]   
 [9] __init__() at C:\Users\18810\.julia\packages\Flux\IjMZL\src\Flux.jl:53
 [10] _include_from_serialized(::String, ::Array{Any,1}) at .\loading.jl:697
 [11] _require_search_from_serialized(::Base.PkgId, ::String) at .\loading.jl:781
 [12] _require(::Base.PkgId) at .\loading.jl:1006
 [13] require(::Base.PkgId) at .\loading.jl:927
 [14] require(::Module, ::Symbol) at .\loading.jl:922
 [15] include(::String) at .\client.jl:439
 [16] top-level scope at none:6
during initialization of module Flux
in expression starting at C:\Users\18810\.julia\packages\Flux\IjMZL\test\runtests.jl:1
ERROR: Package Flux errored during testing
1 个赞

试试这个?

(v1.4) pkg> add NNPACK_jll

谢谢,但还是同样的错误。

    (@v1.4) pkg> add NNPACK_jll
  Resolving package versions...
   Updating `C:\Users\18810\.julia\environments\v1.4\Project.toml`
  [a6bfbf70] + NNPACK_jll v2018.6.22+0
   Updating `C:\Users\18810\.julia\environments\v1.4\Manifest.toml`
 [no changes]

(@v1.4) pkg> test Flux
    Testing Flux
Status `C:\Users\18810\AppData\Local\Temp\jl_1vTf2J\Manifest.toml`
  [621f4979] AbstractFFTs v0.5.0
  [1520ce14] AbstractTrees v0.3.3
  [79e6a3ab] Adapt v2.0.2
  [4c555306] ArrayLayouts v0.3.7
  [b99e7846] BinaryProvider v0.5.10
  [fa961155] CEnum v0.4.1
  [052768ef] CUDA v1.2.0
  [082447d4] ChainRules v0.7.12
  [d360d2e6] ChainRulesCore v0.9.4
  [944b1d66] CodecZlib v0.7.0
  [3da002f7] ColorTypes v0.10.6
  [5ae59095] Colors v0.12.3
  [bbf7d656] CommonSubexpressions v0.3.0
  [e66e0078] CompilerSupportLibraries_jll v0.3.3+0
  [adafc99b] CpuId v0.2.2
  [9a962f9c] DataAPI v1.3.0
  [864edb3b] DataStructures v0.17.19
  [163ba53b] DiffResults v1.0.2
  [b552c78f] DiffRules v1.0.1
  [ffbed154] DocStringExtensions v0.8.2
  [e30172f5] Documenter v0.25.1
  [e2ba6199] ExprTools v0.1.1
  [1a297f60] FillArrays v0.8.13
  [53c48c17] FixedPointNumbers v0.8.3
  [587475ba] Flux v0.11.0
  [f6369f11] ForwardDiff v0.10.12
  [d9f16b24] Functors v0.1.0
  [0c68f7d7] GPUArrays v4.0.1
  [61eb1bfa] GPUCompiler v0.5.3
  [7869d1d1] IRTools v0.4.0
  [c8e1da08] IterTools v1.3.0
  [682c06a0] JSON v0.21.0
  [e5e0dc1b] Juno v0.8.2
  [929cbde3] LLVM v2.0.0
  [bdcacae8] LoopVectorization v0.8.19
  [1914dd2f] MacroTools v0.5.5
  [e89f7d12] Media v0.5.0
  [e1d29d7a] Missings v0.4.3
  [46d2c3a1] MuladdMacro v0.2.2
  [a6bfbf70] NNPACK_jll v2018.6.22+0
  [872c559c] NNlib v0.7.3
  [77ba4419] NaNMath v0.3.4
  [6fe1bfb0] OffsetArrays v1.1.1
  [efe28fd5] OpenSpecFun_jll v0.5.3+3
  [bac558e1] OrderedCollections v1.3.0
  [69de0a69] Parsers v1.0.7
  [189a3867] Reexport v0.2.0
  [ae029012] Requires v1.0.1
  [21efa798] SIMDPirates v0.8.16
  [476501e8] SLEEFPirates v0.5.5
  [a2af1166] SortingAlgorithms v0.3.1
  [276daf66] SpecialFunctions v0.10.3
  [90137ffa] StaticArrays v0.12.4
  [2913bbd2] StatsBase v0.33.0
  [a759f4b9] TimerOutputs v0.5.6
  [3bb67fe8] TranscodingStreams v0.9.5
  [3a884ed6] UnPack v1.0.1
  [3d5dd08c] VectorizationBase v0.12.24
  [a5390f91] ZipFile v0.9.2
  [83775a58] Zlib_jll v1.2.11+14
  [e88e6eb3] Zygote v0.5.3
  [700de1a5] ZygoteRules v0.2.0
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8bb1440f] DelimitedFiles
  [8ba89e20] Distributed
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [44cfe95a] Pkg
  [de0858da] Printf
  [9abbd945] Profile
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA
  [9e88b42a] Serialization
  [6462fe0b] Sockets
  [2f01184e] SparseArrays
  [10745b16] Statistics
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
ERROR: LoadError: InitError: AssertionError: isfile(__libcupti[])
Stacktrace:
 [1] use_artifact_cuda() at C:\Users\18810\.julia\packages\CUDA\h38pe\deps\bindeps.jl:157
 [2] __init_dependencies__() at C:\Users\18810\.julia\packages\CUDA\h38pe\deps\bindeps.jl:314   
 [3] __runtime_init__() at C:\Users\18810\.julia\packages\CUDA\h38pe\src\initialization.jl:112  
 [4] (::CUDA.var"#609#610"{Bool})() at C:\Users\18810\.julia\packages\CUDA\h38pe\src\initialization.jl:32
 [5] lock(::CUDA.var"#609#610"{Bool}, ::ReentrantLock) at .\lock.jl:161
 [6] _functional(::Bool) at C:\Users\18810\.julia\packages\CUDA\h38pe\src\initialization.jl:26  
 [7] functional(::Bool) at C:\Users\18810\.julia\packages\CUDA\h38pe\src\initialization.jl:19   
 [8] functional at C:\Users\18810\.julia\packages\CUDA\h38pe\src\initialization.jl:18 [inlined] 
 [9] __init__() at C:\Users\18810\.julia\packages\Flux\IjMZL\src\Flux.jl:53
 [10] _include_from_serialized(::String, ::Array{Any,1}) at .\loading.jl:697
 [11] _require_search_from_serialized(::Base.PkgId, ::String) at .\loading.jl:781
 [12] _require(::Base.PkgId) at .\loading.jl:1006
 [13] require(::Base.PkgId) at .\loading.jl:927
 [14] require(::Module, ::Symbol) at .\loading.jl:922
 [15] include(::String) at .\client.jl:439
 [16] top-level scope at none:6
during initialization of module Flux
in expression starting at C:\Users\18810\.julia\packages\Flux\IjMZL\test\runtests.jl:1
ERROR: Package Flux errored during testing

我这里是Julia 1.4的,test Flux没有问题

(v1.4) pkg> add Flux
   Updating registry at `~/.julia/registries/General`
#=#=-#                                                                           ##O#- #                                                                          #=#=#  #                                                                         #=#=-#   #                                                                       -#O#-  #   #                                                                                                                                                     0#                                                                               2####                                                                            5########                                                                       10############                                                                   15###################################                                            46#######################################################                        72###########################################################################    98############################################################################# 100.0%
  Resolving package versions...
   Updating `/media/steiner/mycard/julia-package/environments/v1.4/Project.toml`
 [no changes]
   Updating `/media/steiner/mycard/julia-package/environments/v1.4/Manifest.toml`
 [no changes]

(v1.4) pkg> test Flux
    Testing Flux
Status `/tmp/jl_pEc2Sl/Manifest.toml`
  [1520ce14] AbstractTrees v0.3.3
  [79e6a3ab] Adapt v2.0.2
  [b99e7846] BinaryProvider v0.5.10
  [944b1d66] CodecZlib v0.7.0
  [3da002f7] ColorTypes v0.10.6
  [5ae59095] Colors v0.12.3
  [bbf7d656] CommonSubexpressions v0.3.0
  [e66e0078] CompilerSupportLibraries_jll v0.3.3+0
  [9a962f9c] DataAPI v1.3.0
  [864edb3b] DataStructures v0.17.19
  [163ba53b] DiffResults v1.0.2
  [b552c78f] DiffRules v1.0.1
  [53c48c17] FixedPointNumbers v0.8.1
  [587475ba] Flux v0.8.3
  [f6369f11] ForwardDiff v0.10.12
  [e5e0dc1b] Juno v0.8.2
  [1914dd2f] MacroTools v0.5.5
  [e89f7d12] Media v0.5.0
  [e1d29d7a] Missings v0.4.3
  [872c559c] NNlib v0.6.6
  [77ba4419] NaNMath v0.3.3
  [efe28fd5] OpenSpecFun_jll v0.5.3+3
  [bac558e1] OrderedCollections v1.3.0
  [189a3867] Reexport v0.2.0
  [ae029012] Requires v1.0.1
  [a2af1166] SortingAlgorithms v0.3.1
  [276daf66] SpecialFunctions v0.10.3
  [90137ffa] StaticArrays v0.12.4
  [2913bbd2] StatsBase v0.33.0
  [9f7883ad] Tracker v0.2.7
  [3bb67fe8] TranscodingStreams v0.9.5
  [a5390f91] ZipFile v0.9.2
  [83775a58] Zlib_jll v1.2.11+14
  [2a0f44e3] Base64 
  [ade2ca70] Dates 
  [8bb1440f] DelimitedFiles 
  [8ba89e20] Distributed 
  [b77e0a4c] InteractiveUtils 
  [76f85450] LibGit2 
  [8f399da3] Libdl 
  [37e2e46d] LinearAlgebra 
  [56ddb016] Logging 
  [d6f4376e] Markdown 
  [a63ad114] Mmap 
  [44cfe95a] Pkg 
  [de0858da] Printf 
  [9abbd945] Profile 
  [3fa0cd96] REPL 
  [9a3f8284] Random 
  [ea8e919c] SHA 
  [9e88b42a] Serialization 
  [6462fe0b] Sockets 
  [2f01184e] SparseArrays 
  [10745b16] Statistics 
  [8dfed614] Test 
  [cf7118a7] UUIDs 
  [4ec0a83e] Unicode 
┌ Warning: Package PlotThemes does not have Statistics in its dependencies:
│ - If you have PlotThemes checked out for development and have
│   added Statistics as a dependency but haven't updated your primary
│   environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with PlotThemes
└ Loading Statistics into PlotThemes from project dependency, future warnings for PlotThemes are suppressed.
[ Info: Testing Basics
[ Info: Downloading CMUDict dataset
[ Info: Downloading MNIST dataset
[ Info: Downloading MNIST dataset
[ Info: Downloading MNIST dataset
[ Info: Downloading MNIST dataset
[ Info: Downloading Fashion-MNIST dataset
[ Info: Downloading Fashion-MNIST dataset
[ Info: Downloading Fashion-MNIST dataset
[ Info: Downloading Fashion-MNIST dataset
[ Info: Downloading sentiment treebank dataset
[ Info: Downloading iris dataset.
[ Info: Testing Layers
0.044721193126701045
[ Info: Running Gradient Checks
Test Summary: | Pass  Total
Flux          |  196    196
    Testing Flux tests passed 

(v1.4) pkg> 

你要不设置代理,重新下一遍?

julia> ENV["HTTPS_PROXY"] = "http://127.0.0.1:12333"
"http://127.0.0.1:12333"

julia> ENV["JULIA_PKG_SERVER"] = "https://kr.pkg.julialang.org"
"https://kr.pkg.julialang.org"

julia> ENV["HTTP_PROXY"] = "http://127.0.0.1:12333"
"http://127.0.0.1:12333"

在另一台电脑上下载可以直接成功,这台电脑始终不行,重新下载,重新装julia都不行,可能与cuda的环境有关。。。

你能在两台电脑上分别运行一下versioninfo()给我们看看吗

你装 CUDA 了吗?

可以运行的电脑
Julia Version 1.4.2
Commit 44fa15b150* (2020-05-23 18:35 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) m3-6Y30 CPU @ 0.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = "C:\Users\18810\AppData\Local\atom\app-1.48.0\atom.exe"
-a
JULIA_NUM_THREADS = 2
JULIA_PKG_SERVER = https://mirrors.bfsu.edu.cn/julia/static
报错的电脑
Julia Version 1.4.2
Commit 44fa15b150* (2020-05-23 18:35 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: AMD Ryzen Threadripper 3990X 64-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, znver1)
Environment:
JULIA_PKG_SERVER = https://mirrors.bfsu.edu.cn/julia/static

会不会是AMD的问题啊,我去slack帮你问问 :rofl:

您的电脑有装Nvidia的卡吗,好像是CUDA的问题

好像有装,实验室的电脑 :rofl:有什么解决方案嘛

看看CUDA有没有问题吧

感谢!问题暂时解决。

问题出现在CUDA.jl在使用GPU时,需要NVIDIA的驱动以及相应的Toolkit,驱动需要在NVIDIA官网上自行下载,Toolkit可以自行下载,也可以通过artifacts自动寻找,这个报错应该是在寻找时出现问题。

解决方案:

  1. 本质上还是CUDA没有装好,可以通过手动自行配置CUDA的环境,包括Driver和Toolkit两部分,按照文档中提示手动下载安装后可以正常使用CUDA.jl和Flux.jl,atrifacts也不会再报错。
  2. 可以禁用artifacts,通过修改环境变量JULIA_CUDA_USE_BINARYBUILDER为false,这样跳过了检查,Flux.jl可以在不使用GPU的情况下可以暂时正常使用。(test依然失败)

Flux.jl的GPU支持
https://fluxml.ai/Flux.jl/stable/gpu/
CUDA.jl的环境配置
https://juliagpu.gitlab.io/CUDA.jl/installation/overview/#InstallationOverview-1

2 个赞