Skip to content

Commit

Permalink
update nixpkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
gjeusel committed Feb 24, 2018
1 parent c668923 commit 0e291fc
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 12 deletions.
25 changes: 15 additions & 10 deletions dotfiles/.ipython/profile_default/startup/deeproof_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

# Custom imports
from deeproof.common import DATA_DIR, IMAGE_DIR, SNAPSHOT_DIR, SUBMISSION_DIR, setup_logs
from deeproof.neuro import ResNet, ShortNet
from deeproof.neuro.handcraft import ResNet, ShortNet
from deeproof.dataset import RoofDataset, train_valid_split
from deeproof.train import train, snapshot
from deeproof.train import train
from deeproof.validation import validate
from deeproof.prediction import predict, write_submission_file
from deeproof.main import DeepRoof
from deeproof.model_handler import DeepRoofHandler

log = logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s',
level=logging.INFO,
Expand Down Expand Up @@ -57,19 +57,24 @@
normalize
])

drq = DeepRoof(run_name, logger,
ds_transform_augmented, ds_transform_raw,
sampler=None, limit_load=100)
drq = DeepRoofHandler(logger,
ds_transform_augmented, ds_transform_raw,
sampler=None, limit_load=100)

# model = ResNet50(4)
model = ShortNet((3, 64, 64))
im, labels, labels_bin = drq.X_train[0]
y_true = labels
y_pred = torch.Tensor([[0.2, 0.1, 0.6, 0.1]]*4)

# model = ResNet(50)
net = ShortNet((3, 64, 64))

# criterion = ConvolutedLoss()
weight = torch.Tensor([1., 1.971741, 3.972452, 1.824547])
criterion = torch.nn.MultiLabelSoftMarginLoss(weight=weight)
criterion = torch.nn.CrossEntropyLoss(weight=weight)

# Note, p_training has lr_decay automated
optimizer = optim.SGD(model.parameters(), lr=1e-2, momentum=0.9,
optimizer = optim.SGD(net.parameters(), lr=1e-2, momentum=0.9,
weight_decay=0.0005) # Finetuning whole model

# drq.train(epochs=1, model=model, loss_func=criterion, optimizer=optimizer)
# drq.train(epochs=1, model=net, loss_func=criterion, optimizer=optimizer, record_model=False)
8 changes: 6 additions & 2 deletions nix/nix-shell/nix-shell-deepRoof.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,21 @@ stdenv.mkDerivation {
python36Packages.scikitlearn
python36Packages.xgboost

#python36Packages.pypillowfight
python36Packages.pillow-simd
python36Packages.pypillowfight
#python36Packages.pillow-simd
bazel
#python36Packages.tensorflow
#python36Packages.tensorflowCuda
#python36Packages.tensorflowWithoutCuda

python36Packages.pytorch
#python36Packages.pytorchWithoutCuda
#python36Packages.pytorchWithCuda
python36Packages.torchvision

python36Packages.opencv # fore haze removal
python36Packages.opencv3

python36Packages.h5py # used by keras

# web:
Expand Down
26 changes: 26 additions & 0 deletions nix/nixpkgs/custom-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,32 @@ packageOverrides = super: let self = super.pkgs; in with self; rec {
buildInputs = [cmake pythonPackages.scipy pythonPackages.scikitlearn];
};

floyd-cli = pythonPackages.buildPythonPackage rec {
pname = "floyd-cli";
version = "0.10.31";
name = "${pname}-v${version}";

src = fetchFromGitHub {
owner = "floydhub";
repo = "${pname}";
rev = "v${version}";
sha256 = "15ccg6jhr1skvkwd7dzx7gbv3jdczwd8qssg9h466n8m9vgq3dgg";
};
buildInputs = [
pythonPackages.click
pythonPackages.clint
pythonPackages.requests
pythonPackages.requests-toolbelt
pythonPackages.marshmallow
pythonPackages.pytz
pythonPackages.tabulate
pythonPackages.pathlib2
pythonPackages.raven
];

doCheck=false;
};

werkzeug = pythonPackages.buildPythonPackage rec {
name = "werkzeug-${version}";
version = "0.12.2";
Expand Down
12 changes: 12 additions & 0 deletions nix/nixpkgs/pythontoolbox.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ python.buildEnv.override {

# ML:
pkgs.pythonPackages.pandas

# Perso
pkgs.pythonPackages.click
pkgs.pythonPackages.clint
pkgs.pythonPackages.requests
pkgs.pythonPackages.requests-toolbelt
pkgs.pythonPackages.marshmallow
pkgs.pythonPackages.pytz
pkgs.pythonPackages.tabulate
pkgs.pythonPackages.pathlib2
pkgs.pythonPackages.raven
floyd-cli
];
ignoreCollisions = true;
}
Expand Down

0 comments on commit 0e291fc

Please sign in to comment.