Using PyTorch in Julia Language via PyCall.
- Julia >= 1.0
- PyTorch >= 1.0 with Python 3 (Anaconda3 is recommended)
- PyCall >= 1.19
You can tell PyCall.jl which Python you would like to use by exporting PYTHON
environment variable in your .bashrc
or .zshrc
, e.g., if I wish to use the Python in Anaconda3 I can add the line
export PYTHON="/home/xiucheng/anaconda3/bin/python"
You may consider install this chrome extension to read the equations in this repository.
- Linear Regression
- Logistic Regression
- MLP
- Convolutional Neural Net
- Residual Neural Net implements resnet described in paper.
- Word2Vec implements Skip-Gram described in paper.
- Variational Auto-Encoder implements VAE described in paper.
- Normalizing Flows implements normalizing flows described in paper. Also see this great tutorial.
The codes can be run in command line or Jupyter notebook. For example,
$ julia vae.jl --nepoch 15
Defining PyTorch nn.Module in Julia
@pydef mutable struct Model <: nn.Module
function __init__(self, ...)
pybuiltin(:super)(Model, self).__init__()
self.f = ...
end
function forward(self, x)
self.f(x)
end
end