Skip to content

Instantly share code, notes, and snippets.

View alxndrkalinin's full-sized avatar

Alexandr Kalinin alxndrkalinin

View GitHub Profile
@rwightman
rwightman / standalone_bifpn.py
Last active January 27, 2023 06:09
Use effdet BiFPN standalone
from typing import Callable, Union
from dataclasses import dataclass
import timm
import torch.nn as nn
from effdet.efficientdet import BiFpn
from effdet.config import fpn_config
from omegaconf import DictConfig
@Chris-hughes10
Chris-hughes10 / EfficientDet Pytorch-lightning with EfficientNet v2 backbone Blog Post.ipynb
Last active April 22, 2024 08:57
EfficientDet Pytorch-lightning with EfficientNet v2 backbone Blog Post.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ed-alertedh
ed-alertedh / tf_cuda_subprocess.py
Created November 23, 2018 04:38
Decorator to transparently launch Tensorflow code in a subprocess to ensure GPU memory is freed afterwards
import os
import cloudpickle
from multiprocessing import Pool
class RunAsCUDASubprocess:
def __init__(self, num_gpus=0, memory_fraction=0.8):
self._num_gpus = num_gpus
self._memory_fraction = memory_fraction
@staticmethod
@MInner
MInner / run_release_gpu.py
Created July 27, 2018 22:49
Release GPU memory after tensorflow session is closed
def run_release_gpu(func):
def parallel_wrapper(output_dict, *argv, **kwargs):
ret = func(*argv, **kwargs)
if ret is not None:
output_dict['ret'] = ret
def outer_wrapper(*argv, **kwargs):
same_process = kwargs.pop('same_process', False)
if same_process:
return func(*argv, **kwargs)
@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.
-- Xception model
-- a Torch7 implementation of: https://arxiv.org/abs/1610.02357
-- E. Culurciello, October 2016
require 'nn'
local nClasses = 1000
function nn.SpatialSeparableConvolution(nInputPlane, nOutputPlane, kW, kH)
local block = nn.Sequential()
block:add(nn.SpatialConvolutionMap(nn.tables.oneToOne(nInputPlane), kW,kH, 1,1, 1,1))
@DrewML
DrewML / Theming-Slack-OSX.md
Last active January 25, 2022 00:53
Theming Slack for OSX

Theming Slack for OSX

So, you love Slack, but you hate applications with large white backgrounds? Why not use Dark Mode!

Unfortunately, Slack does not have a Dark Mode, although it's on their list of possibilities.

But, don't fret - there is a solution! Because the slack native desktop apps are just wrappers around a web app, we can inject our own CSS to customize the application to our liking.

How to (OSX Only)

Here's how to make jQuery DataTables work with npm and webpack. DT checks for AMD compatibility first
which breaks when you're using CommonJS with webpack.
Install DT core: npm install datatables.net
Install a DT style: npm install datatables.net-bs (bootstrap)
Install the imports-loader webpack plugin: https://github.com/webpack/imports-loader#disable-amd
Create a loader "exception" just for DT in webpack.config.js:
module: {
loaders: [
@shagunsodhani
shagunsodhani / DistributedGraphLab.md
Created April 11, 2016 02:01
Notes for "Distributed GraphLab: A Framework for Machine Learning and Data Mining in the Cloud" paper.

Introduction

  • GraphLab abstraction exposes asynchronous, dynamic, graph-parallel computation model in the shared-memory setting.
  • This paper extends the abstraction to the distributed setting.
  • Link to the paper.

Characteristics of MLDM (Machine Learning and Data Mining)

  • Graph Structured Computation
  • Sometimes computation requires modeling dependencies between data.
@shagunsodhani
shagunsodhani / Word2Vec.md
Created March 20, 2016 15:04
Summary of paper titled "Efficient Estimation of Word Representations in Vector Space"

Efficient Estimation of Word Representations in Vector Space

Introduction

Model Architecture