Skip to content

Instantly share code, notes, and snippets.

View amaarora's full-sized avatar
🎯
Focusing

Aman Arora amaarora

🎯
Focusing
View GitHub Profile
@amaarora
amaarora / Timm.ipynb
Created March 26, 2021 18:46
Plot SPPs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@amaarora
amaarora / exp_01_Optimizers.ipynb
Created March 14, 2021 00:55
Notebook to compare performance b/w various Optimizers including implementations from scratch.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@amaarora
amaarora / timm_schedulers.ipynb
Created March 7, 2021 00:33
aman_arora/git/experiments/nbs/timm_scheduler.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@amaarora
amaarora / TTP-benchmark.ipynb
Last active January 13, 2021 06:16
aman_arora/git/pytorch-image-models/notebooks/TTP-benchmark.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@amaarora
amaarora / fastuple (<map at 0x7f79d0fee7d0>).ipynb
Created November 16, 2020 20:52
aman_arora/git/fastcore/nbs/fastuple.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def __init__(self, funcs=None, as_item=False, split_idx=None):
self.split_idx,self.default = split_idx,None
if isinstance(funcs, Pipeline): self.fs = funcs.fs
else:
if isinstance(funcs, Transform): funcs = [funcs]
self.fs = L(ifnone(funcs,[noop])).map(mk_transform).sorted(key='order')
for f in self.fs:
name = camel2snake(type(f).__name__)
a = getattr(self,name,None)
if a is not None: f = L(a)+f
#Cell
class TfmdList(FilteredBase, L, GetAttr):
"A `Pipeline` of `tfms` applied to a collection of `items`"
_default='tfms'
def __init__(self, items, tfms, use_list=None, do_setup=True, as_item=True, split_idx=None, train_setup=True, splits=None):
super().__init__(items, use_list=use_list)
self.splits = L([slice(None),[]] if splits is None else splits).map(mask2idxs)
if isinstance(tfms,TfmdList): tfms = tfms.tfms
if isinstance(tfms,Pipeline): do_setup=False
self.tfms = Pipeline(tfms, as_item=as_item, split_idx=split_idx)
#Cell
@docs
@delegates(TfmdList)
class DataSource(FilteredBase):
"A dataset that creates a tuple from each `tfms`, passed thru `item_tfms`"
def __init__(self, items=None, tfms=None, tls=None, n_inp=None, dl_type=None, **kwargs):
super().__init__(dl_type=dl_type)
self.tls = L(tls if tls else [TfmdList(items, t, **kwargs) for t in L(ifnone(tfms,[None]))])
self.n_inp = (1 if len(self.tls)==1 else len(self.tls)-1) if n_inp is None else n_inp