Skip to content

Instantly share code, notes, and snippets.

@ottonemo
ottonemo / tabnet_skorch_port.ipynb
Created March 11, 2021 11:55
port of tabnet example to skorch
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[[package]]
name = "atomicwrites"
version = "1.4.0"
description = "Atomic file writes."
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[[package]]
name = "attrs"
class IDS(torch.utils.data.IterableDataset):
def genxy(self):
for _ in range(10):
xs, ys = [], []
for batch_idx in range(5):
xs.append(torch.zeros(2, 2) + batch_idx)
ys.append(torch.tensor(batch_idx))
yield torch.stack(xs), torch.stack(ys)
def __iter__(self):
return iter(self.genxy())
#!/bin/sh
git checkout v0.5.0
python <<EOF
import pickle
import skorch
import skorch.toy
name: nuclei
channels:
- defaults
dependencies:
- appdirs=1.4.3=py36h28b3542_0
- asn1crypto=0.24.0=py36_0
- attrs=18.2.0=py36h28b3542_0
- automat=0.7.0=py36_0
- backcall=0.1.0=py36_0
- blas=1.0=mkl
import torch
import pickle
ts = [torch.ones(10, 20) + n for n in range(4)]
diff = 0
with open('tensor.pickle', 'wb') as f:
for t in ts:
start = f.tell()
torch.save(t, f)