From 1a0bf80b956a75683708c92e599d02976837263e Mon Sep 17 00:00:00 2001 From: FredericWantiez Date: Wed, 8 Nov 2023 21:13:38 +0000 Subject: [PATCH 1/4] Move things around --- ext/AdvancedPSLibtaskExt.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/AdvancedPSLibtaskExt.jl b/ext/AdvancedPSLibtaskExt.jl index d6062fd..e8a3d4d 100644 --- a/ext/AdvancedPSLibtaskExt.jl +++ b/ext/AdvancedPSLibtaskExt.jl @@ -131,6 +131,7 @@ function AbstractMCMC.step( # Create reference trajectory. AdvancedPS.forkr(copy(state.trajectory)) else + println(model) trng = AdvancedPS.TracedRNG() trace = AdvancedPS.Trace(deepcopy(model), trng) AdvancedPS.addreference!(trace.model.ctask.task, trace) # TODO: Do we need it here ? From c40741fc403d1ced472d4bf33a052a42e9e0d8ef Mon Sep 17 00:00:00 2001 From: FredericWantiez Date: Fri, 3 Nov 2023 21:10:36 +0000 Subject: [PATCH 2/4] Add test, fix comments --- ext/AdvancedPSLibtaskExt.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/ext/AdvancedPSLibtaskExt.jl b/ext/AdvancedPSLibtaskExt.jl index e8a3d4d..d6062fd 100644 --- a/ext/AdvancedPSLibtaskExt.jl +++ b/ext/AdvancedPSLibtaskExt.jl @@ -131,7 +131,6 @@ function AbstractMCMC.step( # Create reference trajectory. AdvancedPS.forkr(copy(state.trajectory)) else - println(model) trng = AdvancedPS.TracedRNG() trace = AdvancedPS.Trace(deepcopy(model), trng) AdvancedPS.addreference!(trace.model.ctask.task, trace) # TODO: Do we need it here ? From 4336d9045fb1d9758b1d59dd5c5f7f25c52d962e Mon Sep 17 00:00:00 2001 From: FredericWantiez Date: Wed, 8 Nov 2023 21:12:54 +0000 Subject: [PATCH 3/4] Copy --- Project.toml | 1 + ext/AdvancedPSLibtaskExt.jl | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index d9a9cf7..bec398a 100644 --- a/Project.toml +++ b/Project.toml @@ -6,6 +6,7 @@ version = "0.5.3" [deps] AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" +Libtask = "6f1fad26-d15e-5dc8-ae53-837a1d7b8c9f" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Random123 = "74087812-796a-5b5d-8853-05524746bad3" Requires = "ae029012-a4dd-5104-9daa-d747884805df" diff --git a/ext/AdvancedPSLibtaskExt.jl b/ext/AdvancedPSLibtaskExt.jl index d6062fd..f402928 100644 --- a/ext/AdvancedPSLibtaskExt.jl +++ b/ext/AdvancedPSLibtaskExt.jl @@ -32,8 +32,13 @@ function AdvancedPS.LibtaskModel( ) end +""" + copy(model::AdvancedPS.LibtaskModel) + +The task is copied (forked) and the inner model is deepcopied. +""" function Base.copy(model::AdvancedPS.LibtaskModel) - return AdvancedPS.LibtaskModel(model.f, copy(model.ctask)) + return AdvancedPS.LibtaskModel(deepcopy(model.f), copy(model.ctask)) end const LibtaskTrace{R} = AdvancedPS.Trace{<:AdvancedPS.LibtaskModel,R} From f4cef2779d5752576af719f0dd6778eb0681481b Mon Sep 17 00:00:00 2001 From: Hong Ge Date: Thu, 9 Nov 2023 19:44:13 +0000 Subject: [PATCH 4/4] Update Project.toml --- Project.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index bec398a..4524aa4 100644 --- a/Project.toml +++ b/Project.toml @@ -1,12 +1,11 @@ name = "AdvancedPS" uuid = "576499cb-2369-40b2-a588-c64705576edc" authors = ["TuringLang"] -version = "0.5.3" +version = "0.5.4" [deps] AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" -Libtask = "6f1fad26-d15e-5dc8-ae53-837a1d7b8c9f" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Random123 = "74087812-796a-5b5d-8853-05524746bad3" Requires = "ae029012-a4dd-5104-9daa-d747884805df"