Skip to content

Instantly share code, notes, and snippets.

View hypnopump's full-sized avatar

Eric Alcaide hypnopump

View GitHub Profile
@jeanfeydy
jeanfeydy / environment.yml
Created March 8, 2021 15:25
An example of conda environment to run dMaSIF.
name: rapids-0.16
channels:
- anaconda
- rapidsai
- nvidia
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=1_gnu
@hypnopump
hypnopump / dihedral_angle_from_coordinates.py
Last active February 29, 2024 20:53
Dihedral angles from coordinates. Get dihedral angles from protein backbone coordinates. Calculate Phi, Psi from 3D coordinates of (N-term, C-alpha and C-term)
""" Dihedral angles from coordinates. Get dihedral angles from
protein backbone coordinates.
This script takes 4 vectors representing 4 points as input
and returns the dihedral angle between them.
The script was originally developed to calculate dihedral angles (phi,psi)
from protein backbone atoms' coordinates in 3D (N-term, C-alhpa, Cterm).
"""
import numpy as np
@HadrienG2
HadrienG2 / High_Performance_Rust.md
Last active July 2, 2024 08:11
Making Rust a perfect fit for high-performance computations

Hello, Rust community!

My name is Hadrien and I am a software performance engineer in a particle physics lab. My daily job is to figure out ways to make scientific software use hardware more efficiently without sacrificing its correctness, primarily by adapting old-ish codebases to the changes that occured in the software and computing landscape since the days where they were designed:

  • CPU clock rates and instruction-level parallelism stopped going up, so optimizing code is now more important.
  • Multi-core CPUs went from an exotic niche to a cheap commodity, so parallelism is not optional anymore.
  • Core counts grow faster than RAM prices go down, so multi-processing is not enough anymore.
  • SIMD vectors become wider and wider, so vectorization is not a gimmick anymore.
@jonathanBieler
jonathanBieler / cmaes.jl
Last active December 18, 2019 12:26
CMAES.jl
module CMAES
using Optim, Distributions, Parameters
import Optim: ZerothOrderOptimizer, ZerothOrderState, initial_state, update_state!,
trace!, assess_convergence, AbstractOptimizerState, update!, value, value!, pick_best_x,
pick_best_f
struct CMA <: Optim.ZerothOrderOptimizer
λ::Int
σ::Float64
@SLAPaper
SLAPaper / reuters_mlp_comparison (relu, elu, selu, swish).py
Last active October 26, 2021 19:41
Compare RELU, ELU, SELU, Swish and Scaled Swish in Reuters MLP (based on Keras' example)
'''Compares self-normalizing MLPs with regular MLPs.
Compares the performance of a simple MLP using two
different activation functions: RELU and SELU
on the Reuters newswire topic classification task.
# Reference:
Klambauer, G., Unterthiner, T., Mayr, A., & Hochreiter, S. (2017).
Self-Normalizing Neural Networks. arXiv preprint arXiv:1706.02515.
https://arxiv.org/abs/1706.02515
@rwightman
rwightman / median_pool.py
Last active May 3, 2024 09:03
PyTorch MedianPool (MedianFilter)
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair, _quadruple
class MedianPool2d(nn.Module):
""" Median pool (usable as median filter when stride=1) module.
@naoko
naoko / Install OpenFst with Python Binding on OSX
Last active October 23, 2021 19:38
How to install OpenFst with Python Biding on OSX
# download
curl -O http://www.openfst.org/twiki/pub/FST/FstDownload/openfst-1.6.2.tar.gz
tar -xvzf openfst-1.6.2.tar.gz
rm openfst-1.6.2.tar.gz
cd openfst-1.6.2
./configure --enable-python
make
make install
# Test installtion
@kenzotakahashi
kenzotakahashi / pytorch_gru.py
Last active February 4, 2020 17:35
PyTorch GRU example with a Keras-like interface.
import numpy as np
from sklearn.model_selection import train_test_split
import torch
import torch.nn as nn
from torch.autograd import Variable
np.random.seed(1337)
MAX_LEN = 30
@0xnurl
0xnurl / openfst_python_on_macos.md
Last active October 23, 2021 17:35
Installing OpenFST Native Python Extension on MacOS

Installing OpenFst Native Python Extension on MacOS

Starting from version 1.5, OpenFst has offered a native Python module, making the use of external wrappers like PyFst unnecessary. This has been greatly helpful since PyFst doesn't support Python 3.

1. Install OpenFst

@ax3l
ax3l / CUDA_Compilers.md
Last active July 12, 2024 15:15
CUDA Compilers