TensorFlow.jl
TensorFlow.jl: An Idiomatic Julia Front End for TensorFlow - Published in JOSS (2018)
Science Score: 95.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
Found .zenodo.json file -
✓DOI references
Found 6 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
✓Committers with academic emails
5 of 38 committers (13.2%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Keywords from Contributors
Scientific Fields
Repository
A Julia wrapper for TensorFlow
Basic Info
Statistics
- Stars: 883
- Watchers: 41
- Forks: 110
- Open Issues: 78
- Releases: 27
Topics
Metadata Files
README.md
TensorFlow
A wrapper around TensorFlow, a popular open source machine learning framework from Google.
| ⚠️ Notice ⚠️ | | --- | | Tensorflow.jl is in minimal maintenance mode | | While it works, it is not receiving new features, and is bound to an old version, 1.13.1, of libtensorflow.| | The authors recommend Flux.jl for new users. |
Documentation
Other resources:
Why use TensorFlow.jl?
See a list of advantages over the Python API.
What's changed recently?
See NEWS.
Basic usage
```julia
using TensorFlow using Test
sess = TensorFlow.Session()
x = TensorFlow.constant(Float64[1,2]) y = TensorFlow.Variable(Float64[3,4]) z = TensorFlow.placeholder(Float64)
w = exp(x + z + -y)
run(sess, TensorFlow.globalvariablesinitializer()) res = run(sess, w, Dict(z=>Float64[1,2])) @test res[1] ≈ exp(-1) ```
Installation
Install via
julia
Pkg.add("TensorFlow")
To enable support for GPU usage on Linux, set an environment variable TF_USE_GPU to "1" and then rebuild the package. eg
julia
ENV["TF_USE_GPU"] = "1"
Pkg.build("TensorFlow")
CUDA 8.0 and cudnn are required for GPU usage. If you need to use a different version of CUDA, or if you want GPU support on Mac OS X, you can compile libtensorflow from source.
Initial precompilation (eg, the first time you type using TensorFlow) can take around five minutes, so please be patient. Subsequent load times will only be a few seconds.
Installation via Docker
Simply run docker run -it malmaud/julia:tf to open a Julia REPL that already
has TensorFlow installed:
julia
julia> using TensorFlow
julia>
For a version of TensorFlow.jl that utilizes GPUs, use nvidia-docker run -it malmaud/julia:tf_gpu.
Download nvidia-docker if you don't
already have it.
Logistic regression example
Realistic demonstration of using variable scopes and advanced optimizers
```julia using TensorFlow using Distributions using Printf
Generate some synthetic data
x = randn(100, 50) w = randn(50, 10) yprob = exp.(x*w) yprob ./= sum(y_prob,dims=2)
function draw(probs) y = zeros(size(probs)) for i in 1:size(probs, 1) idx = rand(Categorical(probs[i, :])) y[i, idx] = 1 end return y end
y = draw(y_prob)
Build the model
sess = Session(Graph())
X = placeholder(Float64, shape=[-1, 50]) Y_obs = placeholder(Float64, shape=[-1, 10])
variablescope("logisiticmodel"; initializer=Normal(0, .001)) do global W = getvariable("W", [50, 10], Float64) global B = getvariable("B", [10], Float64) end
Y=nn.softmax(X*W + B)
Loss = -reducesum(log(Y).*Yobs) optimizer = train.AdamOptimizer() minimize_op = train.minimize(optimizer, Loss) saver = train.Saver()
Run training
run(sess, globalvariablesinitializer()) checkpointpath = mktempdir() @info("Checkpoint files saved in $checkpointpath") for epoch in 1:100 curloss, _ = run(sess, [Loss, minimizeop], Dict(X=>x, Yobs=>y)) println(@sprintf("Current loss is %.2f.", curloss)) train.save(saver, sess, joinpath(checkpointpath, "logistic"), globalstep=epoch) end ```
Troubleshooting
If you see issues from the ccall or python interop, try updating TensorFlow both in Julia and in the global python install:
julia
julia> Pkg.build("TensorFlow")
bash
$ pip install --upgrade tensorflow
Citing
If you use this software in your research, we would really appreciate if you cite us.
Malmaud, J. & White, L. (2018). TensorFlow.jl: An Idiomatic Julia Front End for TensorFlow. Journal of Open Source Software, 3(31), 1002, https://doi.org/10.21105/joss.01002
Optional: Using a custom TensorFlow binary
To build TensorFlow from source, or if you already have a TensorFlow binary that you wish to use, follow these instructions. This is recommended by Google for maximum performance, and is currently needed for Mac OS X GPU support.
For Linux users, a convenience script is included to use Docker to easily build the library. Just install docker and run julia build_libtensorflow.so from the "deps" directory of the TensorFlow.jl package. Note that this method may not link to all libraries available on the target system such as Intel MKL.
Owner
- Name: Jonathan Malmaud
- Login: malmaud
- Kind: user
- Website: malmaud.com
- Repositories: 26
- Profile: https://github.com/malmaud
JOSS Publication
TensorFlow.jl: An Idiomatic Julia Front End for TensorFlow
Authors
Tags
julialang tensorflow machine learning neural networks deep learningGitHub Events
Total
- Issues event: 1
- Watch event: 6
- Fork event: 1
Last Year
- Issues event: 1
- Watch event: 6
- Fork event: 1
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Jon Malmaud | m****d@g****m | 608 |
| Lyndon White | o****x@u****u | 190 |
| Lyndon White | l****e@r****u | 80 |
| Katie Hyatt | k****t@p****u | 40 |
| adam | a****i@i****l | 30 |
| Johan Gustafsson | j****n@2****i | 21 |
| Mike J Innes | m****s@g****m | 18 |
| yeesian | n****n@g****m | 14 |
| alex.terenin | a****n@p****m | 8 |
| pevnak | p****k@g****m | 7 |
| Fredrik Bagge Carlson | c****b@u****g | 7 |
| Tony Kelman | t****y@k****t | 6 |
| Elliot Saba | s****t@g****m | 6 |
| Olivier Thill | o****l@e****k | 5 |
| Asim Shankar | a****r@g****m | 4 |
| kevin-w-li | k****i@o****m | 4 |
| Keno Fischer | k****o@j****m | 3 |
| Lars Mescheder | L****r@g****t | 3 |
| byronbest | 4****t | 3 |
| Stephen Smith | 3****9 | 3 |
| karenl7 | k****7@s****u | 2 |
| femtocleaner[bot] | f****] | 2 |
| WooKyoung Noh | w****h@g****m | 2 |
| Andreas Noack | a****n@g****m | 2 |
| Colin Phillips | c****p@d****a | 2 |
| Guido Kraemer | g****r | 2 |
| Henry Poitras | k****u@g****m | 2 |
| Páll Haraldsson | P****n@g****m | 2 |
| Alexander Barth | b****r@g****m | 1 |
| Alexander Terenin | a****n | 1 |
| and 8 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 58
- Total pull requests: 44
- Average time to close issues: 6 months
- Average time to close pull requests: about 2 months
- Total issue authors: 43
- Total pull request authors: 15
- Average comments per issue: 2.93
- Average comments per pull request: 3.34
- Merged pull requests: 28
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- oxinabox (4)
- PallHaraldsson (4)
- montyvesselinov (3)
- askrix (3)
- daxinnan (2)
- stevengj (2)
- abianco88 (2)
- Keno (2)
- staticfloat (2)
- industriousrebel (1)
- MoonCoral (1)
- chelseas (1)
- johnnychen94 (1)
- mbeach42 (1)
- holmesconan (1)
Pull Request Authors
- oxinabox (15)
- malmaud (7)
- PallHaraldsson (5)
- kailaix (4)
- byronbest (3)
- Keno (2)
- aterenin (1)
- MoonCoral (1)
- gustafsson (1)
- askrix (1)
- Alexander-Barth (1)
- metanoid (1)
- blair0011 (1)
- johnnychen94 (1)
- staticfloat (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
- Total downloads: unknown
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 3
juliahub.com: TensorFlow
A Julia wrapper for TensorFlow
- Documentation: https://docs.juliahub.com/General/TensorFlow/stable/
- License: MIT
-
Latest release: 0.11.0
published almost 7 years ago
Rankings
Dependencies
- AutoHashEquals 0.1.0
- Compat 0.18
- Conda 0.6.0
- Distributions 0.10.2
- FileIO 0.1.2
- JLD2 0.0.6
- Juno 0.2.3
- MLDatasets 0.3.0
- MacroTools 0.3.6
- ProtoBuf 0.6.1
- PyCall 1.7.1
- SpecialFunctions v0.7.0
- SpecialFunctions 0.7.0
- StatsFuns 0.3.0
- julia 0.7
- tensorflow/tensorflow latest build
- tensorflow/tensorflow latest-gpu build
- docker latest build
- tensorflow/tensorflow 1.1.0-rc0-devel build
- tensorflow/tensorflow 1.1.0-rc0-devel-gpu build
