Skip to content

Instantly share code, notes, and snippets.

Luca Antiga lantiga

Block or report user

Report or block lantiga

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
lantiga /
Last active May 25, 2020
🤗 Huggingface Bert on RedisAI
from transformers import BertForQuestionAnswering
import torch
bert_name = "bert-large-uncased-whole-word-masking-finetuned-squad"
model = BertForQuestionAnswering.from_pretrained(bert_name, torchscript=True)
inputs = [torch.ones(1, 2, dtype=torch.int64),
torch.ones(1, 2, dtype=torch.int64),
lantiga /
Last active May 6, 2020
Ultralytics YOLO v3 on RedisAI
# This script saves the ultralytics/yolov3 model to TorchScript
# so that it can be used in RedisAI (or from other C/C++ runtimes)
# git clone
# cd yolov3
# conda create -n pytorch python=3.7
# conda install -yc pytorch pytorch torchvision
# conda install -y numpy opencv
# Copy this script to the root of the repo (yolov3) and run
lantiga /
Last active May 5, 2020
Build RedisAI with PyTorch backend on NVIDIA Jetson
sudo apt update
sudo apt install -y git build-essential ninja-build cmake python3-pip python3-cffi redis unzip wget
git clone
cd RedisAI
mkdir build
lantiga /
Last active Feb 6, 2018
CycleGAN pretrained
import torch
import torch.nn as nn
class ResnetBlock(nn.Module):
def __init__(self, dim):
super(ResnetBlock, self).__init__()
self.conv_block = self.build_conv_block(dim)
lantiga /
Created Feb 6, 2018
Indexed convolution

Indexed convolutions

A convolution operator over a 1D tensor (BxCxL), where a list of neighbors for each element is provided through a indices tensor (LxK), where K is the size of the convolution kernel. Each row of indices specifies the indices of the K neighbors of the corresponding element in the input. A -1 is handled like for zero padding.

Note that the neighbors specified in indices are not relative, but rather absolute. They have to be specified for each of the elements of the output.

A use case is for convolutions over non-square lattices, such as images on hexagonal lattices coming from Cherenkov telescopes (


lantiga /
Created Sep 11, 2017
PyTorch namespaces tests
import torch
import torch.nn as nn
from torch.autograd import Variable
from graphviz import Digraph
def name(node, annotation=None):
kind = node.kind()
lantiga / vmtk.rb
Created Jun 10, 2017
Brew formula for vmtk 1.3.2
View vmtk.rb
class Vmtk < Formula
desc "The Vascular Modeling Toolkit"
homepage ""
url ""
version "1.3.2"
sha256 "2632a74341605bd3ddd97971fad70941329e77a112f9363bc5053a1e2ba7c30e"
head ""
revision 1
# bottle do
View gist:0e4ec0297a4c54bc0ec1
### Keybase proof
I hereby claim:
* I am lantiga on github.
* I am lantiga ( on keybase.
* I have a public key whose fingerprint is C364 40F7 E6D0 2B02 AF9C FC34 BE4B 71AA 57A8 4B6A
To claim this, I am signing this object:
lantiga / core.clj
Last active Aug 29, 2015
Naive pure rule engine
View core.clj
(ns carla.core
(:require [clojure.math.combinatorics :as combo]))
(defn- fact-matches? [fact match]
(= match (select-keys fact (keys match))))
(defn make-rules [] [])
(defn make-session [] {:facts #{}})
lantiga /
Last active Jul 21, 2019
State management in ki (
ki macro (export $name $val)
(js exports.$name = $val)
ki require core
// Ported from
ki (ns diff
You can’t perform that action at this time.