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
def dvc_clean(): | |
import ubelt as ub | |
import yaml | |
dvc_root = ub.Path('.').resolve() | |
subdir = dvc_root / 'MySubdirectory' | |
ub.Path(ub.cmd('dvc cache dir', cwd=dvc_root, check=True)['out'].strip()) | |
def list_subdir_dvc_fpaths(subdir): | |
dvc_fpaths = [] | |
prog = ub.ProgIter(desc='walking') |
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
# import pycodestyle | |
import ubelt as ub | |
VERBOSE = 3 | |
def exec_flake8(dpaths, select=None, ignore=None, max_line_length=79): | |
if VERBOSE > 1: | |
print('ignore = {!r}'.format(ignore)) | |
args_list = ['--max-line-length', f'{max_line_length:d}'] |
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
6190010320010213417794501427120152665560619838379962172624809259242413133662471762706831535160803392841378532145762285099722187617972879813538517518233083306753347260548612898631147332011693627724889751066418150260498985083827355788699194931492232877245108779894625292904047223527216984663982750718623034958051309209333582174176577416459542020450843576169829816732864243397351533895411990483910832697254726363069230161517405040607673995815031529773327058337354301354062371647075206440061759885500802331823316853484399773382885418238331848120196431594456195805808432630836739945562939048610470071338082942418797034098249235121992937130708313446300865889713718389590277346247758021822613993586445131379268791654064089880558143900268099653583909158946828975519742188414010911014106643945712874253761637932854216545020272237775646331705506726197042829531280095737537148740518436741171103518386444450294779963654796639163475149693245937407808337856106834434695344937970746060176768499672131001455338379607532097417780722737895226 |
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
def demo_vectorized_interface(): | |
""" | |
This demonstrates how to use the kwcoco vectorized interface for images / | |
categories / annotations. | |
""" | |
import kwcoco | |
import ubelt as ub | |
# Dummy data for the demo | |
coco_dset = kwcoco.CocoDataset.demo('vidshapes3', num_frames=5) | |
# Reroot to make file-paths more readable in this demo as relative paths |
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
import redbaron | |
import ubelt as ub | |
import re | |
import xdev | |
# INPUT: | |
# fpath = <path-to-the-file> | |
text = open(fpath).read() |
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
""" | |
References: | |
https://github.com/willmcgugan/rich/blob/master/rich/_loop.py | |
https://twitter.com/graingert/status/1432827783357607937 | |
""" | |
from typing import Iterable, Tuple, TypeVar | |
T = TypeVar("T") | |
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
# https://gis.cdc.gov/grasp/covidnet/COVID19_5.html | |
# 2020-21 | |
import ubelt as ub | |
US_POP_APPROX = 330e6 | |
SAMPLE_SIZE = US_POP_APPROX * 0.1 | |
print(SAMPLE_SIZE) | |
# NOTE: These are lab-verified COVID numbers. The sample size is 190509. This | |
# represents about 10% of the US population. This chart says total observed |
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
def lazy_install(module_name, submodules, submod_attrs): | |
""" | |
Defines gettr for lazy import via PEP 562 | |
https://www.python.org/dev/peps/pep-0562/ | |
""" | |
import sys | |
import importlib | |
import importlib.util | |
all_funcs = [] | |
for mod, funcs in submod_attrs.items(): |
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
""" | |
Experiment Script Related to Pytorch Memory Leak Issue | |
References: | |
https://github.com/pytorch/pytorch/issues/13246 | |
https://gist.github.com/mprostock/2850f3cd465155689052f0fa3a177a50 | |
""" | |
from torch.utils.data import Dataset, DataLoader | |
import numpy as np | |
import torch |
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
(py36) joncrall@Ooo:~/code/netharn$ python setup.py build | |
-------------------------------------------------------------------------------- | |
-- Trying "Ninja" generator | |
-------------------------------- | |
--------------------------- | |
---------------------- | |
----------------- | |
------------ |