TensorBFS / TensorInference.jl

Probabilistic inference using contraction of tensor networks
https://tensorbfs.github.io/TensorInference.jl/
MIT License
18 stars 2 forks source link

setup documentation #39

Closed GiggleLiu closed 1 year ago

GiggleLiu commented 1 year ago

How to develop

To make life easier, please use the LiveServer,

julia docs/serve.jl

BUT! we need wait for this PR to be merge, otherwise, you will run into infinite loops. https://github.com/tlienart/LiveServer.jl/pull/168

Examples are included in the examples folder, they will be compiled with Literate. Each folder is an example, each example should contain a main.jl file.

GiggleLiu commented 1 year ago

@mroavi Could you please help me fix the tests? the error described here #38

mroavi commented 1 year ago

@GiggleLiu Copy-paste the Artifacts.toml inside the test dir into the docs dir. Let me know if that works.

GiggleLiu commented 1 year ago

@GiggleLiu Copy-paste the Artifacts.toml inside the test dir into the docs dir. Let me know if that works.

I am wondering if there is a convenient way for users to use that artifact.

mroavi commented 1 year ago

@GiggleLiu Yes, there is. They just need to copy paste the Artifacts.toml into the root dir of their project, making sure that the artifcat gets installed by adding these lines somewhere at the beginning of the code:

  import Pkg;
  Pkg.ensure_artifact_installed("uai2014", joinpath(@__DIR__, "Artifacts.toml"));

Now they should be able to get the path to any file in the artifact using the artifact"<NAME>" macro, for example:

      model_filepath = joinpath(artifact"uai2014", "MAR", problem_name * ".uai")

The tarball is hosted in a git repo that I created: https://github.com/mroavi/uai-2014-inference-competition. I plan to move this repo to TensorBFS soon.

I added an explanation in the README of how to update the Artifact. This involves 1. Changing something inside the uai2014 dir, 2. compressing this dir into a tarball and pushing it to the remote repo, 3. re-generating the Artifacts.toml which can be done with the project inside utils/create-artifacts-toml. Once this is done, that Artifacts.toml needs to be copy-pasted into the project that wants to use the tarball hosted in my repo.

mroavi commented 1 year ago

The problem that you got above is that the SHA inside the Artifacts.toml does not coincide with the SHA of the tarball https://github.com/mroavi/uai-2014-inference-competition/raw/main/uai2014.tar.gz.

mroavi commented 1 year ago

I'm almost done fixing the tests (which involves updating the tarball often and following all those steps). As soon as I fix the tests, we are rarely going to need to update the tarball. Let me know if there is stuff that is not clear.

GiggleLiu commented 1 year ago

Can we provide a function to help users download the artifacts? otherwise it looks not very friendly in the documentation.

mroavi commented 1 year ago

That is what Pkg.ensure_artifact_installed does. It is not clear to me how we could make this even simpler. What I did in the docs of JunctionTrees.jl was to create an assets dir to store the problem files used in the examples so that users don't get confused with Artifacts. What do you think of doing something similar in TensorInference.jl?

GiggleLiu commented 1 year ago

Now I need to tell users in documentation. How to find the Artifacts.toml, where to place the file, how to download it, and how to use it.

I think we can pipeline this workflow. We can still add Artifacts as a dependency, without automatic download. We provide users a function to generate Artifacts.toml and download artifacts. Then another function to import models from it.

codecov[bot] commented 1 year ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (main@e5ae5a2). Click here to learn what that means. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #39   +/-   ##
=======================================
  Coverage        ?   63.27%           
=======================================
  Files           ?        9           
  Lines           ?      452           
  Branches        ?        0           
=======================================
  Hits            ?      286           
  Misses          ?      166           
  Partials        ?        0           
GiggleLiu commented 1 year ago

The nightly seems to run forever.

GiggleLiu commented 1 year ago

I messed up the branches, let us now move to #45 .