There is a guide of what current packages should do to support the new package manager?
Not sure yet, there is a talk on Pkg3 from JuliaCon:
So basically many things fail. Below are what I know so far
@yebai Can you take care of updating the coroutine thing?
Oh I actually manage to hack it.
After fixing things mentioned above, I meet a problem in out compiler. I guess there is some change which makes our implementation doesn't work any more. I pushed my branch (https://github.com/TuringLang/Turing.jl/tree/github.com/TuringLang/Turing.jl/issues/462) with temp-fixes described above which makes using Turing work. Now below fails and I haven't figured out why
using Turing
@model g() = begin
x ~ Normal(0, 1)
end
g()
end
with error
ERROR: LoadError: MethodError: objects of type Int64 are not callable
Stacktrace:
[1] eval at ./boot.jl:319 [inlined]
[2] eval(::Expr) at ./client.jl:399
[3] #g#3(::Dict{Symbol,Any}, ::Dict{Symbol,Any}, ::Function) at /Users/kai/.julia/dev/Turing/src/core/compiler.jl:323
[4] g() at ./none:0
[5] top-level scope at none:0
in expression starting at <macrocall>:0
I made some updates to the branch at the JuliaCon hackathon today. All the syntax errors should be fixed for 1.0 now. I still haven't nailed down the compiler error, but will continue working on it.
Thanks @yebai and @trappmartin !
I just pushed some commits to add Markdown to REQUIRE and resolve one syntax warning.
I resolved some syntax errors in the test. The compiler tests currently fail on my machine, and other tests probably too.
Is Turing Julia 1.0 ready?
We are working on it. Stay tuned.
I fixed the compiler issue. Please check my last two commits: 64b956b95499ccd1d81e1631983daf6ab1156991 and 24ba6cabd996530f4f560664b6622d86e7c86f9a
Until now we can do the following
@model m(x) = begin
a ~ Normal(0, 1)
x ~ Nromal(a, 1)
end
mf = m(1)
But when I call mf() I still get an error:
julia> mf()
ERROR: type is immutable
Stacktrace:
[1] setproperty! at ./sysimg.jl:19 [inlined]
[2] observe(::Nothing, ::Normal{Float64}, ::Int64, ::Turing.VarReplay.VarInfo) at /Users/kai/.julia/dev/Turing/src/samplers/sampler.jl:92
[3] ##m_model#368 at ./REPL[2]:65 [inlined]
[4] ##m_model#368(::Turing.VarReplay.VarInfo, ::Nothing) at ./none:0
[5] ##m_model#368() at ./none:1
[6] top-level scope at none:0
This may be related to my hack in 64b956b95499ccd1d81e1631983daf6ab1156991.
I fixed the compiler issue. Please check my last two commits: 64b956b and 24ba6ca
For better readability and maintainability, I think we should split the compiler into small functions and add tests to them.
@yebai, @xukai92 I just pushed a few quick fixes to this branch, one to get around the mutability error that @xukai92 is reporting. Feel free to cherry-pick or ignore altogether if not useful.
@hessammehr Many thanks! I’ve merged your PR. This is going a lot faster than I thought. We might be able to get Turing work on 1.0 this week!
@yebai No problem! I really hope so, and that we can do a clean refactor to make Turing more maintainable as well.
Presently, I get the following confusing internal error message with @xukai92's code snippet.
using Turing
using Distributions
@model m(x) = begin
a ~ Normal(0, 1)
x ~ Normal(a, 1)
end
mf = m(1)
mf()
rec_backtrace at /home/Administrator/buildbot/worker/package_win64/build/src\stackwalk.c:94
record_backtrace at /home/Administrator/buildbot/worker/package_win64/build/src\task.c:246
jl_throw at /home/Administrator/buildbot/worker/package_win64/build/src\task.c:577
jl_type_error_rt at /home/Administrator/buildbot/worker/package_win64/build/src\rtutils.c:118
jl_type_error at /home/Administrator/buildbot/worker/package_win64/build/src\rtutils.c:124
jl_f_issubtype at /home/Administrator/buildbot/worker/package_win64/build/src\builtins.c:415
typeof_tfunc at .\compiler\tfuncs.jl:393
typeof_tfunc at .\compiler\tfuncs.jl:391
typeof_tfunc at .\compiler\tfuncs.jl:396
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2182
jl_apply at /home/Administrator/buildbot/worker/package_win64/build/src\julia.h:1538 [inlined]
jl_f__apply at /home/Administrator/buildbot/worker/package_win64/build/src\builtins.c:563
builtin_tfunction at .\compiler\tfuncs.jl:1170
builtin_tfunction at .\compiler\tfuncs.jl:1079
abstract_call at .\compiler\abstractinterpretation.jl:551
abstract_eval_call at .\compiler\abstractinterpretation.jl:798
abstract_eval at .\compiler\abstractinterpretation.jl:883
typeinf_local at .\compiler\abstractinterpretation.jl:1107
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1163
typeinf at .\compiler\typeinfer.jl:15
typeinf_edge at .\compiler\typeinfer.jl:492
abstract_call_method at .\compiler\abstractinterpretation.jl:321
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:81
abstract_call at .\compiler\abstractinterpretation.jl:769
abstract_eval_call at .\compiler\abstractinterpretation.jl:798
abstract_eval at .\compiler\abstractinterpretation.jl:883
typeinf_local at .\compiler\abstractinterpretation.jl:1107
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1163
typeinf at .\compiler\typeinfer.jl:15
typeinf_edge at .\compiler\typeinfer.jl:492
abstract_call_method at .\compiler\abstractinterpretation.jl:321
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:81
abstract_call at .\compiler\abstractinterpretation.jl:769
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2182
abstract_apply at .\compiler\abstractinterpretation.jl:477
abstract_call at .\compiler\abstractinterpretation.jl:525
abstract_eval_call at .\compiler\abstractinterpretation.jl:798
abstract_eval at .\compiler\abstractinterpretation.jl:883
typeinf_local at .\compiler\abstractinterpretation.jl:1107
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1163
typeinf at .\compiler\typeinfer.jl:15
typeinf_edge at .\compiler\typeinfer.jl:492
abstract_call_method at .\compiler\abstractinterpretation.jl:321
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:81
abstract_call at .\compiler\abstractinterpretation.jl:769
abstract_eval_call at .\compiler\abstractinterpretation.jl:798
abstract_eval at .\compiler\abstractinterpretation.jl:883
typeinf_local at .\compiler\abstractinterpretation.jl:1107
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1163
typeinf at .\compiler\typeinfer.jl:15
typeinf_edge at .\compiler\typeinfer.jl:492
abstract_call_method at .\compiler\abstractinterpretation.jl:321
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:81
abstract_call at .\compiler\abstractinterpretation.jl:769
abstract_eval_call at .\compiler\abstractinterpretation.jl:798
abstract_eval at .\compiler\abstractinterpretation.jl:883
typeinf_local at .\compiler\abstractinterpretation.jl:1107
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1163
typeinf at .\compiler\typeinfer.jl:15
typeinf_edge at .\compiler\typeinfer.jl:492
abstract_call_method at .\compiler\abstractinterpretation.jl:321
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:81
abstract_call at .\compiler\abstractinterpretation.jl:769
abstract_eval_call at .\compiler\abstractinterpretation.jl:798
abstract_eval at .\compiler\abstractinterpretation.jl:883
typeinf_local at .\compiler\abstractinterpretation.jl:1107
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1163
typeinf at .\compiler\typeinfer.jl:15
typeinf_edge at .\compiler\typeinfer.jl:492
abstract_call_method at .\compiler\abstractinterpretation.jl:321
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:81
abstract_call at .\compiler\abstractinterpretation.jl:769
abstract_eval_call at .\compiler\abstractinterpretation.jl:798
abstract_eval at .\compiler\abstractinterpretation.jl:883
typeinf_local at .\compiler\abstractinterpretation.jl:1107
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1163
typeinf at .\compiler\typeinfer.jl:15
typeinf_ext at .\compiler\typeinfer.jl:567
typeinf_ext at .\compiler\typeinfer.jl:604
jfptr_typeinf_ext_1.clone_1 at C:\Users\Uigedail\AppData\Local\Julia-0.7.0\lib\julia\sys.dll (unknown line)
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2182
jl_apply at /home/Administrator/buildbot/worker/package_win64/build/src\julia.h:1538 [inlined]
jl_apply_with_saved_exception_state at /home/Administrator/buildbot/worker/package_win64/build/src\rtutils.c:257
jl_type_infer at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:275
jl_compile_method_internal at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:1784 [inlined]
jl_fptr_trampoline at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:1828
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2182
do_call at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:324
eval_value at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:428
eval_stmt_value at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:363 [inlined]
eval_body at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:682
jl_interpret_toplevel_thunk_callback at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:799
unknown function (ip: FFFFFFFFFFFFFFFE)
unknown function (ip: 0000000022A4990F)
unknown function (ip: FFFFFFFFFFFFFFFF)
jl_toplevel_eval_flex at /home/Administrator/buildbot/worker/package_win64/build/src\toplevel.c:831
jl_toplevel_eval_in at /home/Administrator/buildbot/worker/package_win64/build/src\builtins.c:633
eval at .\boot.jl:319
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2182
eval_user_input at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\REPL\src\REPL.jl:85
macro expansion at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\REPL\src\REPL.jl:117 [inlined]
#28 at .\task.jl:262
jl_fptr_trampoline at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:1829
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2182
jl_apply at /home/Administrator/buildbot/worker/package_win64/build/src\julia.h:1538 [inlined]
start_task at /home/Administrator/buildbot/worker/package_win64/build/src\task.c:268
WARNING: Base.e is deprecated, use ℯ (\euler) or `Base.MathConstants.e`
in module Turing
WARNING: Base.e is deprecated, use ℯ (\euler) or `Base.MathConstants.e`
in module Turing
WARNING: Base.e is deprecated, use ℯ (\euler) or `Base.MathConstants.e`
in module Turing
Internal error: encountered unexpected error in runtime:
TypeError(func=:<:, context="", expected=Type{T} where T, got=T0<:Real)
┌ Warning: broadcast will default to iterating over its arguments in the future. Wrap arguments of
Seems to me like an issue with the task.c shim.
Seems to me like an issue with the task.c shim.
Did you recompile task.c?
@hessammehr There is a variable name change in julia's task type. I just fixed it in Turing's task.c. We need to re-complile LibtaskBuilder2.
I also get that error but still manage to initialise vi by calling mf().
Also, after making Chain mutable, we are in the stage where we are kind of blocked by Mamba.Chain. As I mentioned in the very beginning of this issue, I disabled Mamba.Chain. I simply did this by commenting out Mamba.Chain and defining a dummy AbstractChain type (see https://github.com/TuringLang/Turing.jl/blob/github.com/TuringLang/Turing.jl/issues/462/src/Turing.jl#L25-L28).
Now when I try to call sample(mf, IS(100)), I get
ERROR: MethodError: no method matching Turing.Chains(::Array{Float64,3}; names=AbstractString["a", "lp"])
Closest candidates are:
Turing.Chains() at /Users/kai/.julia/dev/Turing/src/Turing.jl:28 got unsupported keyword argument "names"
Stacktrace:
[1] flatten!(::Turing.Chain) at /Users/kai/.julia/dev/Turing/src/core/io.jl:121
[2] Turing.Chain(::Float64, ::Array{Turing.Sample,1}) at /Users/kai/.julia/dev/Turing/src/core/io.jl:105
[3] sample(::getfield(Main, Symbol("###m_model#368")), ::IS) at /Users/kai/.julia/dev/Turing/src/samplers/is.jl:50
[4] top-level scope at none:0
which is because of the lack of the real implementation of Chain utility functions.
Update:
The task.c code has been updated to support Julia 1.0 (ref: https://github.com/hessammehr/LibtaskBuilder2/pull/1) .
I'm working on fixing task copying on the Julia side. The issue is that consume/produce has been removed from Julia 1.0. The new channel API does not work on copied coroutines. I'm investigating why that's the case.
Blocking issues for Julia 1.0
Waiting for this, thanks for the hard work.
Most helpful comment
We are working on it. Stay tuned.