diff --git a/docs/CondaPkg.toml b/docs/CondaPkg.toml deleted file mode 100644 index 4bd19d9..0000000 --- a/docs/CondaPkg.toml +++ /dev/null @@ -1,2 +0,0 @@ -[deps] -gdown = "" diff --git a/docs/Project.toml b/docs/Project.toml index 5c394d9..24eb43e 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -2,7 +2,6 @@ AlgebraOfGraphics = "cbdf2221-f076-402e-a563-3d30da359d67" CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" -CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab" DataDeps = "124859b0-ceae-595e-8997-d05f6a7a8dfe" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" @@ -13,7 +12,6 @@ MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54" NeuralOperators = "ea5c82af-86e5-48da-8ee1-382d6ad7af4b" Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" -PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d" Reactant = "3c362404-f566-11ee-1572-e11a4b42c853" Scratch = "6c6a2e73-6563-6170-7368-637461726353" @@ -21,7 +19,6 @@ Scratch = "6c6a2e73-6563-6170-7368-637461726353" AlgebraOfGraphics = "0.10.7, 0.11, 0.12, 0.13" CSV = "0.10, 1.0" CairoMakie = "0.13, 0.14, 0.15" -CondaPkg = "0.2.23" DataDeps = "0.7.13, 1.0" DataFrames = "1" Documenter = "1.7.0" @@ -32,6 +29,5 @@ MLUtils = "0.4.4" NeuralOperators = "0.7" Optimisers = "0.4" Printf = "1.10, < 0.0.1, 1" -PythonCall = "0.9.23" Reactant = "0.2.130" Scratch = "1.3.0" diff --git a/docs/src/tutorials/burgers_deeponet.md b/docs/src/tutorials/burgers_deeponet.md index af2cbd0..5eea26f 100644 --- a/docs/src/tutorials/burgers_deeponet.md +++ b/docs/src/tutorials/burgers_deeponet.md @@ -4,16 +4,14 @@ ```@example burgers using MAT, MLUtils, Printf, DataDeps -using PythonCall, CondaPkg # For `gdown` - -const gdown = pyimport("gdown") register( DataDep( - "Burgers", + "BurgersR10", """ Burgers' equation dataset from - [fourier_neural_operator](https://github.com/zongyi-li/fourier_neural_operator) + [fourier_neural_operator](https://github.com/zongyi-li/fourier_neural_operator), + mirrored at [kks32/sciml-dataset](https://huggingface.co/datasets/kks32/sciml-dataset). mapping between initial conditions to the solutions at the last point of time \ evolution in some function space. @@ -23,16 +21,12 @@ register( * `a`: initial conditions u(x,0) * `u`: solutions u(x,t_end) """, - "https://drive.google.com/uc?id=16a8od4vidbiNR3WtaBPCSZ0T3moxjhYe", - "9cbbe5070556c777b1ba3bacd49da5c36ea8ed138ba51b6ee76a24b971066ecd"; - fetch_method=(url, local_dir) -> begin - pyconvert(String, gdown.download(url, joinpath(local_dir, "Burgers_R10.zip"))) - end, - post_fetch_method=unpack, + "https://huggingface.co/datasets/kks32/sciml-dataset/resolve/982685ff70965591682682dddd284d35e670ac7f/fno/burgers_data_R10.mat", + "d1a0456776255a4bd841dbc18951d3f468266d945d96e24ae531a12f18bb5a1a", ), ) -filepath = joinpath(datadep"Burgers", "burgers_data_R10.mat") +filepath = joinpath(datadep"BurgersR10", "burgers_data_R10.mat") const N = 2048 const Δsamples = 2^3 diff --git a/docs/src/tutorials/burgers_fno.md b/docs/src/tutorials/burgers_fno.md index 9ad58e3..38f0350 100644 --- a/docs/src/tutorials/burgers_fno.md +++ b/docs/src/tutorials/burgers_fno.md @@ -4,17 +4,15 @@ ```@example burgers_fno using DataDeps, MAT, MLUtils -using PythonCall, CondaPkg # For `gdown` using Printf -const gdown = pyimport("gdown") - register( DataDep( - "Burgers", + "BurgersR10", """ Burgers' equation dataset from - [fourier_neural_operator](https://github.com/zongyi-li/fourier_neural_operator) + [fourier_neural_operator](https://github.com/zongyi-li/fourier_neural_operator), + mirrored at [kks32/sciml-dataset](https://huggingface.co/datasets/kks32/sciml-dataset). mapping between initial conditions to the solutions at the last point of time \ evolution in some function space. @@ -24,16 +22,12 @@ register( * `a`: initial conditions u(x,0) * `u`: solutions u(x,t_end) """, - "https://drive.google.com/uc?id=16a8od4vidbiNR3WtaBPCSZ0T3moxjhYe", - "9cbbe5070556c777b1ba3bacd49da5c36ea8ed138ba51b6ee76a24b971066ecd"; - fetch_method=(url, local_dir) -> begin - pyconvert(String, gdown.download(url, joinpath(local_dir, "Burgers_R10.zip"))) - end, - post_fetch_method=unpack, + "https://huggingface.co/datasets/kks32/sciml-dataset/resolve/982685ff70965591682682dddd284d35e670ac7f/fno/burgers_data_R10.mat", + "d1a0456776255a4bd841dbc18951d3f468266d945d96e24ae531a12f18bb5a1a", ), ) -filepath = joinpath(datadep"Burgers", "burgers_data_R10.mat") +filepath = joinpath(datadep"BurgersR10", "burgers_data_R10.mat") const N = 2048 const Δsamples = 2^3 diff --git a/src/layers.jl b/src/layers.jl index 1b70a44..bdf64e3 100644 --- a/src/layers.jl +++ b/src/layers.jl @@ -345,8 +345,10 @@ function (layer::GridEmbedding)(x::AbstractArray{T, N}, ps, st) where {T, N} size(x, N), ) - # Move the CPU-built grid to the same device as x (fixes CUDA scalar indexing, #125) - grid = Lux.get_device(x)(grid) + # Place the CPU-built grid on `x`'s device (fixes CUDA scalar indexing, #125). + # This must not query the device at runtime: `Lux.get_device(x)` errors + # inside `Reactant.@compile`. + grid = (similar(x, eltype(grid), size(grid)) .= grid) return cat(grid, x; dims = N - 1), st end