Skip to content

Instantly share code, notes, and snippets.

@hushell
hushell / test.py
Last active January 30, 2024 14:09
tinyllama_mole
'''
python test.py recipes/tinyllama_mole/sft/config_routeraux_ep3.yaml
'''
import logging
import random
import sys
import datasets
import torch
@hushell
hushell / colmap_main.py
Last active November 27, 2023 16:50
COLMAP known poses preparation from DTU data
import cv2
import numpy as np
import trimesh
import os
import glob
from PIL import Image
from colmap_utils import qvec2rotmat, rotmat2qvec, read_images_binary, read_cameras_text, read_images_text
def load_K_Rt_from_P(P):
@hushell
hushell / gist:23e68eef236673655db4635b80297c40
Created September 27, 2023 21:02
qnn-net-run profiling
This is the detailed profiling:
```
Execute Stats:
Execute Stat 1
Number of HVX threads used : 4 count
RPC (execute) time : 2717302 us
QNN accelerator (execute) time : 2714698 us
Num times yield occured : 0 count
@inproceedings{karras2020analyzing,
title={Analyzing and improving the image quality of stylegan},
author={Karras, Tero and Laine, Samuli and Aittala, Miika and Hellsten, Janne and Lehtinen, Jaakko and Aila, Timo},
booktitle={Proceedings of the IEEE/CVF conference on computer vision and pattern recognition},
pages={8110--8119},
year={2020}
}
@article{radford2019language,
title={Language models are unsupervised multitask learners},
import torch
from srt.encoder import SRTEncoder
from srt.decoder import SRTDecoder, NerfDecoder
import yaml
batch_size = 1
num_views = 2
device = torch.device("cuda:0")
# https://github.com/lucidrains/vit-pytorch/blob/main/vit_pytorch/vit_pytorch.py
import torch
import torch.nn.functional as F
from einops import rearrange
from torch import nn
from torch.nn.modules.utils import _pair
MIN_NUM_PATCHES = 16
@hushell
hushell / convert_imagenet_to_h5.py
Last active November 11, 2021 00:47
convert_imagenet_to_h5.py
import os
import torch
import h5py as h5
from torchvision import datasets
from tqdm import tqdm
"""
Usage: this script creates `imagenet_train.h5` in `data_path`.
If you need to create `imagenet_val.h5`, set `is_train = False` at L26.
@hushell
hushell / avatr_v2.py
Created September 30, 2021 00:09
AvaTr V2
import copy
from typing import Optional, List
from dotmap import DotMap
import torch
import torch.nn.functional as F
from torch import nn, Tensor
from asteroid_filterbanks import make_enc_dec
#!/usr/bin/env python
# coding: utf-8
import numpy as np
import random
from PIL import Image
import matplotlib.pyplot as plt
import torch#!/usr/bin/env python
# coding: utf-8
import numpy as np
@hushell
hushell / sib_da.py
Created March 25, 2021 09:03
zero-shot SIB for domain adaptation
import os
import time
import math
import itertools
import numpy as np
from PIL import Image
from tqdm import tqdm
from copy import deepcopy
import torch