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 import nn | |
import torch | |
class ModuleWithLazySubmodules(nn.Module): | |
def __init__(self, in_dim, middle_dim, submodules): | |
super().__init__() | |
self.first_layer = nn.Linear(in_dim, middle_dim) | |
self.submodules = nn.Sequential(*submodules) | |
self.forward(torch.rand(1, in_dim)) |
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
silly gist hack, why do we need you? :( |
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
#!/usr/bin/env python3 | |
import glob | |
import os | |
import sys | |
import logging | |
METHODS = ["debug", "info", "warning", "warn", "error", "exception", "critical"] | |
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
#-*- coding: utf-8 -*- | |
import torch | |
from torch import nn | |
from fvcore.nn import FlopCountAnalysis, flop_count_table | |
from pypapi import events, papi_high as high | |
def main(): |
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 detectron2.layers import ShapeSpec | |
from detectron2.modeling import FPN, GeneralizedRCNN, ResNet, StandardROIHeads | |
from detectron2.modeling.anchor_generator import DefaultAnchorGenerator | |
from detectron2.modeling.backbone.fpn import LastLevelMaxPool | |
from detectron2.modeling.backbone.resnet import BasicStem, BottleneckBlock | |
from detectron2.modeling.box_regression import Box2BoxTransform | |
from detectron2.modeling.matcher import Matcher | |
from detectron2.modeling.poolers import ROIPooler | |
from detectron2.modeling.proposal_generator.rpn import RPN, StandardRPNHead | |
from detectron2.modeling.roi_heads import FastRCNNOutputLayers, MaskRCNNConvUpsampleHead |
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
#!/usr/bin/env python | |
from collections import namedtuple | |
from Xlib import X | |
import Xlib.display | |
from Xlib.ext.xtest import fake_input | |
class Screen(namedtuple('_Screen', ['x', 'y', 'w', 'h'])): | |
@property |
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
# -*- coding: utf-8 -*- | |
import sys | |
import pprint | |
import copy | |
from collections import OrderedDict | |
class ComputeAPICall: | |
def __init__(self, api, original): | |
self.api = api | |
self.original = original # original logs |
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
""" | |
Dependencies: | |
pip install \ | |
tabulate ujson msgpack msgpack_numpy numpy pyarrow | |
""" | |
import sys | |
from timeit import timeit | |
import pickle |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
A general curve plotter to create curves such as: | |
https://github.com/ppwwyyxx/tensorpack/tree/master/examples/ResNet | |
A simplest example: | |
$ cat examples/train_log/mnist-convnet/stat.json \ | |
| jq '.[] | .train_error, .validation_error' \ |
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
LOCAL_PATH := $(call my-dir) | |
include $(CLEAR_VARS) | |
LOCAL_MODULE := loader | |
LOCAL_MODULE_TAGS := optional | |
LOCAL_SRC_FILES := loader.c | |
LOCAL_CPPFLAGS := -std=gnu++0x -Wall | |
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -pie -fPIE |
NewerOlder