Improved Cog with the power of Nix
4
stars
142
commits
Nix
primary language
Jul 24, 2024
updated
Build cog images deterministically using Nix.
# build the image and load it into docker
$ nix build github:yorickvp/cognix#torch-demo && ./result load
$ cog predict torch-demo:......
Starting Docker image torch-demo:.... and running setup()...
Running prediction...
cuda works!
$ docker image ls torch-demo:....
REPOSITORY TAG IMAGE ID CREATED SIZE
torch-demo c209d6h86w7j7ksnjks4rkynjfw3ahwb 8fe343a42975 53 years ago 4.7GB
# explore the contribution of various packages to the image size
# format: store-path own-size size-with-deps
$ nix path-info ./result -rSsh | sort -hk3
[..]
/nix/store/rbrw4jb0bz54kznbwwf47lj7k77jg00j-python3.10-nvidia-cudnn-cu11-8.5.0.96 868.8M 1.4G
/nix/store/qqrzrbsgzk3bbg1pfficq5l2qnyz2b2k-python3.10-torch-2.0.1 1.3G 4.3G
$ git clone ...
$ nix build .#ebsynth-cpu && ./result load
$ cog predict ebsynth-cpu:...... -i style=@...
cog.yaml run commandscog at runtimenix run .#gte-large.push-weights)133 commits
9 commits
Nix
53.6%
Go
25.1%
Python
20.6%
Improved Cog with the power of Nix
4
stars
142
commits
Nix
primary language
Jul 24, 2024
updated
Build cog images deterministically using Nix.
# build the image and load it into docker
$ nix build github:yorickvp/cognix#torch-demo && ./result load
$ cog predict torch-demo:......
Starting Docker image torch-demo:.... and running setup()...
Running prediction...
cuda works!
$ docker image ls torch-demo:....
REPOSITORY TAG IMAGE ID CREATED SIZE
torch-demo c209d6h86w7j7ksnjks4rkynjfw3ahwb 8fe343a42975 53 years ago 4.7GB
# explore the contribution of various packages to the image size
# format: store-path own-size size-with-deps
$ nix path-info ./result -rSsh | sort -hk3
[..]
/nix/store/rbrw4jb0bz54kznbwwf47lj7k77jg00j-python3.10-nvidia-cudnn-cu11-8.5.0.96 868.8M 1.4G
/nix/store/qqrzrbsgzk3bbg1pfficq5l2qnyz2b2k-python3.10-torch-2.0.1 1.3G 4.3G
$ git clone ...
$ nix build .#ebsynth-cpu && ./result load
$ cog predict ebsynth-cpu:...... -i style=@...
cog.yaml run commandscog at runtimenix run .#gte-large.push-weights)133 commits
9 commits
Nix
53.6%
Go
25.1%
Python
20.6%