https://github.com/darsnack/fluxprune.jl
Pruning framework and methods for Flux
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 1 committers (100.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (6.4%) to scientific vocabulary
Repository
Pruning framework and methods for Flux
Basic Info
- Host: GitHub
- Owner: darsnack
- License: mit
- Language: Julia
- Default Branch: main
- Size: 31.3 KB
Statistics
- Stars: 27
- Watchers: 2
- Forks: 1
- Open Issues: 1
- Releases: 1
Metadata Files
README.md
FluxPrune
FluxPrune.jl provides iterative pruning algorithms for Flux models. Pruning strategies can be unstructured or structured. Unstructured strategies operate on arrays, while structured strategies operate on layers.
Examples
Unstructured edge pruning
```julia using Flux, FluxPrune using MLUtils: flatten
m = Chain(Conv((3, 3), 3 => 16), Conv((3, 3), 16 => 32), flatten, Dense(512, 10))
prune all weights to 70% sparsity
m̄ = prune(LevelPrune(0.7), m)
prune all weights with magnitude lower than 0.5
m̄ = prune(ThresholdPrune(0.5), m)
prune each layer in a Chain at a different rate
(just uses broadcasting then re-Chains)
m̄ = prune([LevelPrune(0.4), LevelPrune(0.6), identity, LevelPrune(0.7)], m) ```
Structured channel pruning
```julia using Flux, FluxPrune using MLUtils: flatten
m = Chain(Conv((3, 3), 3 => 16), Conv((3, 3), 16 => 32), flatten, Dense(512, 10))
prune all conv layer channels to 30% sparsity
m̄ = prune(ChannelPrune(0.3), m) ```
Mixed pruning
```julia using Flux, FluxPrune using MLUtils: flatten
m = Chain(Conv((3, 3), 3 => 16), Conv((3, 3), 16 => 32), flatten, Dense(512, 10))
apply channel and edge pruning
m̄ = prune([ChannelPrune(0.3), ChannelPrune(0.4), identity, LevelPrune(0.8)], m) ```
Iterative pruning
Target pruning levels step-by-step.
The first argument to iterativeprune (or the function block after the do statement) will finetune the model and return true to indicate moving onto the next stage, or false to indicate that finetune must be called again.
```julia
using Flux, FluxPrune
using MLUtils: flatten
using Statistics: mean
features = rand(Float32, 8, 8, 3, 100); labels = Flux.onehotbatch(rand(0:9, 100), 0:9); data = (features, labels); loss(m, x, y) = Flux.Losses.mse(m(x), y) accuracy(m, data) = mean(Flux.onecold(m(data[1]), 0:9) .== Flux.onecold(data[2], 0:9)) target_accuracy = 0.08 # random data, so this is a low target
m = Chain(Conv((3, 3), 3 => 16), Conv((3, 3), 16 => 32), flatten, Dense(512, 10), softmax) opt_state = Flux.setup(Momentum(), m);
stages = [ [ChannelPrune(0.1), ChannelPrune(0.1), identity, LevelPrune(0.4), identity], [ChannelPrune(0.2), ChannelPrune(0.3), identity, LevelPrune(0.7), identity], [ChannelPrune(0.3), ChannelPrune(0.5), identity, LevelPrune(0.9), identity] ] m̄ = iterativeprune(stages, m) do m̄ for epoch in 1:10 Flux.train!(loss, m̄, [data], optstate) end return accuracy(m̄, data) > targetaccuracy end ```
Owner
- Name: Kyle Daruwalla
- Login: darsnack
- Kind: user
- Location: Cold Spring Harbor Lab, NY
- Website: darsnack.github.io
- Repositories: 67
- Profile: https://github.com/darsnack
NeuroAI scholar at CSHL
GitHub Events
Total
Last Year
Committers
Last synced: over 3 years ago
All Time
- Total Commits: 29
- Total Committers: 1
- Avg Commits per committer: 29.0
- Development Distribution Score (DDS): 0.0
Top Committers
| Name | Commits | |
|---|---|---|
| Kyle Daruwalla | d****a@w****u | 29 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: over 1 year ago
All Time
- Total issues: 4
- Total pull requests: 6
- Average time to close issues: about 7 hours
- Average time to close pull requests: 6 months
- Total issue authors: 3
- Total pull request authors: 3
- Average comments per issue: 1.25
- Average comments per pull request: 0.17
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 4
Past Year
- Issues: 2
- Pull requests: 0
- Average time to close issues: about 15 hours
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 1.5
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- vonpetersenn (2)
- natema (1)
- JuliaTagBot (1)
Pull Request Authors
- github-actions[bot] (4)
- darsnack (1)
- natema (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
- Total downloads: unknown
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 1
juliahub.com: FluxPrune
Pruning framework and methods for Flux
- Documentation: https://docs.juliahub.com/General/FluxPrune/stable/
- License: MIT
-
Latest release: 0.1.0
published about 4 years ago
Rankings
Dependencies
- actions/cache v1 composite
- actions/checkout v2 composite
- julia-actions/julia-buildpkg v1 composite
- julia-actions/julia-runtest v1 composite
- julia-actions/setup-julia v1 composite
- JuliaRegistries/TagBot v1 composite