Skip to content

Commit 81d4313

Browse files
committed
Merge branch 'main' into perturbed-overhaul
2 parents 955b2c5 + 343c95e commit 81d4313

13 files changed

+635
-70
lines changed

.github/workflows/CI.yml

-55
This file was deleted.

.github/workflows/Documentation.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main # update to match your development branch (master, main, dev, trunk, ...)
7+
tags: '*'
8+
pull_request:
9+
10+
concurrency:
11+
# Skip intermediate builds: always.
12+
# Cancel intermediate builds: only if it is a pull request build.
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
15+
16+
jobs:
17+
build:
18+
name: "Documentation"
19+
permissions:
20+
contents: write
21+
pull-requests: read
22+
statuses: write
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: julia-actions/setup-julia@v2
27+
with:
28+
version: '1'
29+
- uses: julia-actions/cache@v2
30+
- name: Install dependencies
31+
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
32+
- name: Build and deploy
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
35+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
36+
run: julia --project=docs/ docs/make.jl
File renamed without changes.

.github/workflows/Test.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
# needed to allow julia-actions/cache to delete old caches that it has created
10+
permissions:
11+
actions: write
12+
contents: read
13+
14+
concurrency:
15+
# Skip intermediate builds: always.
16+
# Cancel intermediate builds: only if it is a pull request build.
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
19+
20+
jobs:
21+
test:
22+
name: Test - Julia ${{ matrix.julia-version }}
23+
runs-on: ubuntu-latest
24+
strategy:
25+
matrix:
26+
julia-version: ['1.10', '1']
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: julia-actions/setup-julia@v2
31+
with:
32+
version: ${{ matrix.julia-version }}
33+
- uses: julia-actions/cache@v2
34+
- uses: julia-actions/julia-buildpkg@v1
35+
- uses: julia-actions/julia-runtest@v1
36+
- uses: julia-actions/julia-processcoverage@v1
37+
- uses: codecov/codecov-action@v4
38+
with:
39+
files: lcov.info
40+
token: ${{ secrets.CODECOV_TOKEN }}
41+
fail_ci_if_error: false

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*.jl.*.cov
33
*.jl.cov
44
*.jl.mem
5-
/Manifest.toml
5+
Manifest.toml
66
/docs/build/
77
/docs/src/index.md
88
/docs/src/tutorial.md

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Statistics = "1"
3636
StatsBase = "0.33, 0.34"
3737
StatsFuns = "1.3"
3838
ThreadsX = "0.1.11"
39-
julia = "1.7"
39+
julia = "1.10"
4040

4141
[extras]
4242
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# InferOpt.jl
22

3-
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://axelparmentier.github.io/InferOpt.jl/stable)
4-
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://axelparmentier.github.io/InferOpt.jl/dev)
5-
[![Build Status](https://github.com/axelparmentier/InferOpt.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/axelparmentier/InferOpt.jl/actions/workflows/CI.yml?query=branch%3Amain)
6-
[![Coverage](https://codecov.io/gh/axelparmentier/InferOpt.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/axelparmentier/InferOpt.jl)
7-
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)
3+
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaDecisionFocusedLearning.github.io/InferOpt.jl/stable)
4+
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://JuliaDecisionFocusedLearning.github.io/InferOpt.jl/dev)
5+
[![Build Status](https://github.com/JuliaDecisionFocusedLearning/InferOpt.jl/actions/workflows/Test.yml/badge.svg?branch=main)](https://github.com/JuliaDecisionFocusedLearning/InferOpt.jl/actions/workflows/Test.yml?query=branch%3Amain)
6+
[![Coverage](https://codecov.io/gh/JuliaDecisionFocusedLearning/InferOpt.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/JuliaDecisionFocusedLearning/InferOpt.jl)
7+
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/JuliaDiff/BlueStyle)
88
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
99

1010
## Overview
@@ -25,7 +25,7 @@ julia> using Pkg; Pkg.add("InferOpt")
2525
To install the development version, run this command instead:
2626

2727
```julia
28-
julia> using Pkg; Pkg.add(url="https://github.com/axelparmentier/InferOpt.jl")
28+
julia> using Pkg; Pkg.add(url="https://github.com/JuliaDecisionFocusedLearning/InferOpt.jl")
2929
```
3030

3131
## Citing us

docs/Project.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
1616
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
1717

1818
[compat]
19+
Documenter = "1.3"
1920
GridGraphs = "0.10"

docs/make.jl

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ DocMeta.setdocmeta!(InferOpt, :DocTestSetup, :(using InferOpt); recursive=true)
66

77
# Copy README.md into docs/src/index.md (overwriting)
88

9+
<<<<<<< HEAD
910
open(joinpath(@__DIR__, "src", "index.md"), "w") do io
1011
println(
1112
io,
@@ -20,6 +21,13 @@ open(joinpath(@__DIR__, "src", "index.md"), "w") do io
2021
println(io, line)
2122
end
2223
end
24+
=======
25+
cp(
26+
joinpath(dirname(@__DIR__), "README.md"),
27+
joinpath(@__DIR__, "src", "index.md");
28+
force=true,
29+
)
30+
>>>>>>> main
2331

2432
# Parse test/tutorial.jl into docs/src/tutorial.md (overwriting)
2533

@@ -52,4 +60,4 @@ for file in
5260
rm(file)
5361
end
5462

55-
deploydocs(; repo="github.com/axelparmentier/InferOpt.jl", devbranch="main")
63+
deploydocs(; repo="github.com/JuliaDecisionFocusedLearning/InferOpt.jl", devbranch="main")

examples/tutorial.jl

+4-3
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,15 @@ Thanks to this smoothing, we can now train our model with a standard gradient op
113113

114114
encoder = deepcopy(initial_encoder)
115115
opt = Flux.Adam();
116+
opt_state = Flux.setup(opt, encoder)
116117
losses = Float64[]
117118
for epoch in 1:100
118119
l = 0.0
119120
for (x, y) in zip(X_train, Y_train)
120-
grads = gradient(Flux.params(encoder)) do
121-
l += loss(encoder(x), y; directions=queen_directions)
121+
grads = Flux.gradient(encoder) do m
122+
l += loss(m(x), y; directions=queen_directions)
122123
end
123-
Flux.update!(opt, Flux.params(encoder), grads)
124+
Flux.update!(opt_state, encoder, grads[1])
124125
end
125126
push!(losses, l)
126127
end;

0 commit comments

Comments
 (0)