This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
I3D network code suitable for conversion in pytorch JIT. | |
Adapted from https://github.com/hassony2/kinetics_i3d_pytorch. | |
""" | |
import torch | |
import torch.nn.functional as F | |
# @torch.jit.script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Sequence, Dict, Iterable, Any, Tuple | |
import jax | |
import jax.numpy as jnp | |
import flax | |
import flax.linen as nn | |
class MLP(nn.Module): | |
features: Sequence[int] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"shortcuts": [ | |
{ | |
"command": "documentsearch:start", | |
"keys": [ | |
"Accel F" | |
], | |
"selector": ".jp-mod-searchable", | |
"disabled": true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from torch.distributions import MultivariateNormal | |
from torch.distributions import kl_divergence | |
mean = torch.rand(10, 100) | |
logstds = torch.rand(10, 100) | |
x = torch.rand(10, 100) | |
dist = MultivariateNormal(mean, scale_tril=torch.stack([torch.diag((ls).exp()) for ls in logstds])) | |
print('Testing LL') | |
print(dist.log_prob(x).mean()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Creating pyvenv | |
python3.6 -m venv --without-pip ~/pyvenvs/zoo | |
source ~/pyvenvs/zoo/bin/activate | |
# Getting pip inside | |
curl https://bootstrap.pypa.io/get-pip.py | python | |
# Reactivating to obtain pip from venv (without it we would use global pip) | |
deactivate && source ~/pyvenvs/zoo/bin/activate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I dunno why, but we should specify 0.0.0.0 IP address for jupyter | |
# when we want to login remotely (for example, aws ec2 or docker) | |
jupyter-lab --ip=0.0.0.0 --no-browser --port=10000 | |
# In case HTTP ports are not open in the server — | |
# use ssh forwarding on local machine | |
ssh -N -f -L localhost:8888:localhost:10000 user@host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get -y install python3-pip python-virtualenv python-dev | |
mkdir virtualenvs | |
virtualenv -p python3 virtualenvs/kek | |
git clone git@github.com:kek/kek-repo.git kek | |
cd kek | |
source ~/virtualenvs/kek/bin/activate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get install python3-pip python-virtualenv virtualenv | |
# and now you can use it via: | |
# virtualenv -p python3 kek | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
# Stop and remove all containers | |
docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) | |
### | |
### | |
# Run docker daemon (if you see stupid error "Cannot connect to the Docker daemon. Is the docker daemon running on this host?") | |
# Ubuntu 14.04: | |
sudo service docker start |
NewerOlder