Skip to content

Instantly share code, notes, and snippets.

View jizongFox's full-sized avatar
🏠
Working from home

Jizong's Fox jizongFox

🏠
Working from home
  • Ecole de technologie superieure (ETS) @LIVIAETS
  • Montreal
  • 11:50 (UTC -12:00)
View GitHub Profile
@jizongFox
jizongFox / test.py
Created November 4, 2022 20:35
splitformer dynamic code
import time
import typing as t
from typing import Union
import torch
from torch import nn, Tensor
from torch.nn import functional as F
from torch.nn.common_types import _size_2_t
from torch.nn.modules.utils import _pair
@jizongFox
jizongFox / python
Created September 27, 2022 15:55
test_function.py
from functools import partial
import matplotlib.pyplot as plt
import torch
from torch import nn
from models.efficientsplitformer.efficientsplitcmtformer2 import _Meta4D, Meta4D, SelfSeparableMeta4D
from models.nn.tokenmixer import MultiHeadSelfAttention, _TokenMixer
from models.nn.mbblock import MBConv, MBConvAttention
@jizongFox
jizongFox / extract_ILSVRC.sh
Created July 28, 2022 03:10 — forked from BIGBALLON/extract_ILSVRC.sh
script for ImageNet data extract.
#!/bin/bash
#
# script to extract ImageNet dataset
# ILSVRC2012_img_train.tar (about 138 GB)
# ILSVRC2012_img_val.tar (about 6.3 GB)
# make sure ILSVRC2012_img_train.tar & ILSVRC2012_img_val.tar in your current directory
#
# https://github.com/facebook/fb.resnet.torch/blob/master/INSTALL.md
#
# train/
@jizongFox
jizongFox / greedy.py
Created June 24, 2021 13:11
k-Center-Greedy algorithm
# demo for https://arxiv.org/pdf/1708.00489.pdf and Fig. 3 of https://arxiv.org/pdf/2106.08265.pdf
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
sample_num = 1000
x_sample = np.random.uniform(-1, 1, sample_num)
y_sample = np.random.uniform(-1, 1, sample_num)
dataset = np.stack([x_sample, y_sample], axis=1)