File tree Expand file tree Collapse file tree 2 files changed +45
-1
lines changed
Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 11{ pkgs ? import <nixpkgs> {
2+ overlays = [
3+ ( import ./overlay/replace-torch.nix { } )
4+ ] ;
25 config = {
36 allowUnfree = true ;
47 cudaSupport = true ;
710, lib ? pkgs . lib
811, my_python ? pkgs . python3
912, cudatoolkit ? pkgs . cudaPackages . cudatoolkit
10- , } :
13+ , unstable_pkgs ? import ( fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz" ) {
14+ overlays = [
15+ ( import ./overlay/replace-torch.nix {
16+ do_replace = true ;
17+ replacement_torch = my_python . pkgs . torch ;
18+ replacement_torchvision = my_python . pkgs . torchvision ;
19+ replacement_torchaudio = my_python . pkgs . torchaudio ;
20+ replacement_python = my_python ;
21+ } )
22+ ] ;
23+ }
24+ } :
1125let
1226 python_packages = my_python . pkgs ;
27+ unstable_python_packages = unstable_pkgs . my_python . pkgs ;
1328in {
1429 pkgs = pkgs ;
1530 lib = lib ;
1833 dependencies = with pkgs ; [
1934 python_packages . numpy
2035 python_packages . torch-bin
36+ unstable_python_packages . pytorch-lightning
2137 cudatoolkit
2238 ] ;
2339}
Original file line number Diff line number Diff line change 1+ { do_replace ? false
2+ , replacement_torch ? false
3+ , replacement_torchvision ? false
4+ , replacement_torchaudio ? false
5+ , replacement_python ? false } :
6+ final : prev :
7+ let
8+ real_python = if do_replace then replacement_python else prev . python311 ;
9+ real_torch = if do_replace then replacement_torch else real_python . pkgs . torch-bin ;
10+ real_torchvision = if do_replace then replacement_torchvision else real_python . pkgs . torchvision-bin ;
11+ real_torchaudio = if do_replace then replacement_torchaudio else real_python . pkgs . torchaudio-bin ;
12+ real_python311 = real_python . override {
13+ packageOverrides = final_ : prev_ : {
14+ torch = real_torch ;
15+ torchvision = real_torchvision ;
16+ torchaudio = real_torchaudio ;
17+ pytorch-lightning = prev_ . pytorch-lightning . override {
18+ torch = real_torch ;
19+ } ;
20+ tensorboardx = prev_ . tensorboardx . override {
21+ torch = real_torch ;
22+ } ;
23+ } ;
24+ } ;
25+ in {
26+ python311 = real_python311 ;
27+ my_python = real_python311 ;
28+ }
You can’t perform that action at this time.
0 commit comments