All Projects β†’ FluxML β†’ DaggerFlux.jl

FluxML / DaggerFlux.jl

Licence: other
Distributed computation of differentiation pipelines to use multiple workers, devices, GPU, etc. since Julia wasn't fast enough already

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to DaggerFlux.jl

Transformers.jl
Julia Implementation of Transformer models
Stars: ✭ 173 (+203.51%)
Mutual labels:  flux
Flooks
🍸 A state manager for React Hooks
Stars: ✭ 201 (+252.63%)
Mutual labels:  flux
react-store
Redux like store with React hooks and Context API
Stars: ✭ 16 (-71.93%)
Mutual labels:  flux
Multi Tenancy
Flux v1: Manage a multi-tenant cluster with Flux and Kustomize
Stars: ✭ 180 (+215.79%)
Mutual labels:  flux
K8s Gitops
GitOps principles to define kubernetes cluster state via code. Community around [emailΒ protected] is on discord: https://discord.gg/7PbmHRK
Stars: ✭ 192 (+236.84%)
Mutual labels:  flux
Smitty
Tiny flux implementation built on mitt
Stars: ✭ 210 (+268.42%)
Mutual labels:  flux
General Store
Simple, flexible store implementation for Flux. #hubspot-open-source
Stars: ✭ 171 (+200%)
Mutual labels:  flux
nifi-influxdb-bundle
InfluxDB Processors For Apache NiFi
Stars: ✭ 30 (-47.37%)
Mutual labels:  flux
Deox
Functional Type-safe Flux Standard Utilities
Stars: ✭ 200 (+250.88%)
Mutual labels:  flux
FluxJS.jl
I heard you like compile times
Stars: ✭ 43 (-24.56%)
Mutual labels:  flux
Typescript Webpack React Redux Boilerplate
React and Redux with TypeScript
Stars: ✭ 182 (+219.3%)
Mutual labels:  flux
Metalhead.jl
Computer vision models for Flux
Stars: ✭ 191 (+235.09%)
Mutual labels:  flux
Blazor Fluxor
DEPRECATED PROJECT. See FLUXOR
Stars: ✭ 216 (+278.95%)
Mutual labels:  flux
Reactor Addons
Official modules for the Reactor project
Stars: ✭ 175 (+207.02%)
Mutual labels:  flux
nanoflux-fusion
Redux-like extension for Nanoflux
Stars: ✭ 15 (-73.68%)
Mutual labels:  flux
Geometricflux.jl
Geometric Deep Learning for Flux
Stars: ✭ 175 (+207.02%)
Mutual labels:  flux
Tinystate
A tiny, yet powerful state management library for Angular
Stars: ✭ 207 (+263.16%)
Mutual labels:  flux
react-molecule
Molecule is a light-weight framework that lets you reason about inter-component communication, dependency injection and logic decoupling.
Stars: ✭ 35 (-38.6%)
Mutual labels:  flux
realt
Realt is a new way to work with Redux inspired by Alt
Stars: ✭ 41 (-28.07%)
Mutual labels:  flux
Denormalizr
Denormalize data normalized with normalizr
Stars: ✭ 231 (+305.26%)
Mutual labels:  flux

DaggerFlux.jl

This is currently an early stage integration between Dagger.jl and Flux.jl to allow for distributed computation of differentiation pipelines to use multiple workers, devices, GPUs etc. This package enables model parallelism for Flux models.

Basic Usage

To see the package in action, we would have to start julia with multiple workers.

Also make sure that the workers have access to the environment and code that is going to be run. This is typically done with the help of the exeflags keyword in addprocs. Something like addprocs(2, exeflags = "--project") is usually enough. Please ensure that the environment has access to DaggerFlux.

julia> using DaggerFlux, Dagger, Flux, Zygote

julia> @everywhere function layer(x)
         @show myid()
         x
       end

julia> ip = rand(3,3);

julia> c = Chain(layer, layer, layer, layer)
Chain(layer, layer, layer, layer)

julia> dc = DaggerChain(c)
DaggerChain(Chain(layer, layer, layer, layer))

julia> dc(ip) # notice the output is a Dagger Thunk rather than an eager evaluation
Thunk[4](layer, (Thunk[3](layer, ...),))

julia> collect(dc(ip))
      From worker 2:    myid() = 2
      From worker 3:    myid() = 3
      From worker 2:    myid() = 2
      From worker 3:    myid() = 3
3Γ—3 Matrix{Float64}:
 0.813575   0.828228  0.0630336
 0.0755053  0.215495  0.64503
 0.462957   0.345485  0.83312

Notice that the model was now evaluated across multiple workers.

Flux models

This is basically the same as before, but we will demo how to differentiate through Flux models.

julia> y, back = Zygote.pullback((m,x) -> m(x), dc, ip)
(Thunk[135](layer, (Thunk[131](layer, ...),)), Zygote.var"#46#47"{typeof(βˆ‚(#11))}(βˆ‚(#11)))

julia> collect(y)
      From worker 3:    myid() = 3
      From worker 3:    myid() = 3
      From worker 2:    myid() = 2
      From worker 2:    myid() = 2
3Γ—3 Matrix{Float64}:
 0.813575   0.828228  0.0630336
 0.0755053  0.215495  0.64503
 0.462957   0.345485  0.83312

julia> back(one.(y))
      From worker 2:    myid() = 2
      From worker 2:    myid() = 2
      From worker 3:    myid() = 3
      [...]
      From worker 2:    myid() = 2
      From worker 3:    myid() = 3
      From worker 2:    myid() = 2
((chain = (layers = (nothing, nothing, nothing, nothing),),), [1.0 1.0 1.0; 1.0 1.0 1.0; 1.0 1.0 1.0])

And now one can optimise over entire models!

Of course one can substitute our dummy model here with more routine models such as ResNet from Metalhead.jl. Here's a slightly simpler model for an example.

julia> m = Chain(Dense(2,2), Dense(2,2))
Chain(
  Dense(2, 2),                          # 6 parameters
  Dense(2, 2),                          # 6 parameters
)                   # Total: 4 arrays, 12 parameters, 304 bytes.

julia> dm = DaggerChain(m)
DaggerChain(Chain(Dense(2, 2), Dense(2, 2)))

julia> y, b = Zygote.pullback((m,x) -> m(x), dm, rand(Float32, 2
,2))
(Thunk[150](Dense(2, 2), (Thunk[149](Dense(2, 2), ...),)), Zygote.var"#46#47"{typeof(βˆ‚(#13))}(βˆ‚(#13)))

julia> b(one.(y))
((chain = (layers = ((weight = Float32[1.0398567 0.45392603; 0.4867683 0.21248773], bias = Float32[1.6065784, 0.75205684], Οƒ = nothing), (weight = Float32[-1.247205 1.2783735; -1.247205 1.278
735], bias = Float32[2.0, 2.0], Οƒ = nothing)),),), Float32[-0.14533046 -0.14533046; -0.58934844 -0.58934844])

Contributions welcome to the GitHub repository!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].