Skip to content

Instantly share code, notes, and snippets.

View i-amgeek's full-sized avatar
🏠
Working from home

Deepak Mangla i-amgeek

🏠
Working from home
View GitHub Profile
@i-amgeek
i-amgeek / Creating Dockerfile for Dockship.md
Last active November 1, 2019 05:46
Creating Dockerfile for Dockship

Creating Dockerfile for Dockship

Hello world 🙌

If you have an AI model which you want to share with the world🌍, Dockship is the place for you. In this article, I will help you create your own Dockerfile in easy steps to upload models on Dockship.

The best way to understand is to look at actual Dockerfile and break it down. Here, we will look at Dockerfile of 'Summer to Winter GAN' for reference.

1. FROM pytorch/pytorch
2. RUN apt-get update
3. RUN pip install certifi==2019.6.16 \

Making sense of Network Pruning

Why are we even talking about this?

Well, Because in past years, most of AI researchers didn't talk about this. Majority was focused on increasing 1% imagenet accuracy even if it makes model size 3x (It have its own advantages). But now, we have good accuracy with models in GBs and we can't deploy them (more problematic for edge devices).

Do we have some direction to solve this issue?🙄

Umm.. Yes. While designing models, one thing researchers find particularly interesting is that most of the weights in neural networks are redundant. They don't contribute in increasing accuracy (sometimes even decrease).

So, how pruning leverage this observation?

Pruning steps

In Pruning, we rank the neurons in the network according to how much they contribute. The ranking can be done according to the L1/L2 mean of neuron weights, their mean activations, the number of times a neuron wasn’t zero on some validation set, and other cr

from flask import Flask, request
from run import Model
import json
app = Flask(__name__,
static_url_path='',
static_folder='')
model = Model()
#!/usr/bin/env python3.6
import fire
import requests
from requests.exceptions import Timeout
from getpass import getpass
import os
import tqdm
import shutil
import subprocess
import zipfile
from dockship_launch import app
if __name__ == "main":
app.run()
import shutil
import requests
import uuid
def load_file(path):
'''
Returns path of input file. If given parameter 'path' is an url,
first downloads the file
'''
@i-amgeek
i-amgeek / utils.py
Last active December 9, 2019 08:52
import shutil
import uuid
import requests
import os
def load_file(path):
'''
Returns path of input file. If given parameter 'path' is an url,
first downloads the file
'''
@i-amgeek
i-amgeek / conv.py
Created March 6, 2020 06:57
Convolution Code
for filter in 0..num_filters
for channel in 0..input_channels
for out_h in 0..output_height
for out_w in 0..output_width
for k_h in 0..kernel_height
for k_w in 0..kernel_width
output[filter, out_h, out_w] +=
kernel[filter, channel, k_h, k_w] *
input[channel, out_h + k_h, out_w + k_w]