diff --git a/pkgs/by-name/rc/rclip/package.nix b/pkgs/by-name/rc/rclip/package.nix new file mode 100644 index 000000000000..072c4ccafa05 --- /dev/null +++ b/pkgs/by-name/rc/rclip/package.nix @@ -0,0 +1,46 @@ +{ lib +, python3Packages +, fetchFromGitHub +}: +python3Packages.buildPythonApplication rec { + pname = "rclip"; + version = "1.7.6"; + pyproject = true; + + src = fetchFromGitHub { + owner = "yurijmikhalevich"; + repo = "rclip"; + rev = "v${version}"; + hash = "sha256-lWaWq+dcAa/2pONka4xRpixqDuL6iYDF46vCyCmVWwE="; + }; + + nativeBuildInputs = with python3Packages; [ + poetry-core + ]; + + propagatedBuildInputs = with python3Packages; [ + open-clip-torch + pillow + requests + torch + torchvision + tqdm + ]; + + nativeCheckInputs = with python3Packages; [ pytestCheckHook ]; + + pythonImportsCheck = [ "rclip" ]; + + disabledTestPaths = [ + # requires network + "tests/e2e/test_rclip.py" + ]; + + meta = with lib; { + description = "AI-Powered Command-Line Photo Search Tool"; + homepage = "https://github.com/yurijmikhalevich/rclip"; + license = licenses.mit; + maintainers = with maintainers; [ iynaix ]; + mainProgram = "rclip"; + }; +} diff --git a/pkgs/development/python-modules/open-clip-torch/default.nix b/pkgs/development/python-modules/open-clip-torch/default.nix new file mode 100644 index 000000000000..f1272e1e3640 --- /dev/null +++ b/pkgs/development/python-modules/open-clip-torch/default.nix @@ -0,0 +1,86 @@ +{ lib +, stdenv +, buildPythonPackage +, braceexpand +, ftfy +, huggingface-hub +, pandas +, protobuf +, pytestCheckHook +, regex +, sentencepiece +, timm +, torch +, torchvision +, tqdm +, transformers +, setuptools +, webdataset +, wheel +, fetchFromGitHub +}: +buildPythonPackage rec { + pname = "open-clip-torch"; + version = "2.23.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "mlfoundations"; + repo = "open_clip"; + rev = "v${version}"; + hash = "sha256-Txm47Tc4KMbz1i2mROT+IYbgS1Y0yHK80xY0YldgBFQ="; + }; + + nativeBuildInputs = [ + setuptools + wheel + ]; + + propagatedBuildInputs = [ + ftfy + huggingface-hub + protobuf + regex + sentencepiece + timm + torch + torchvision + tqdm + ]; + + nativeCheckInputs = [ + pytestCheckHook + braceexpand + pandas + transformers + webdataset + ]; + + pythonImportsCheck = [ "open_clip" ]; + + disabledTestPaths = lib.optionals (stdenv.isAarch64 || stdenv.isDarwin) [ + "tests/test_wds.py" + ]; + + disabledTests = [ + # requires network + "test_download_pretrained_from_hfh" + "test_inference_simple" + "test_inference_with_data" + "test_pretrained_text_encoder" + "test_training_mt5" + ] ++ lib.optionals (stdenv.isAarch64 && stdenv.isLinux) [ + "test_training" + "test_training_coca" + "test_training_unfreezing_vit" + "test_training_clip_with_jit" + ]; + + meta = with lib; { + description = "An open source implementation of CLIP"; + homepage = "https://github.com/mlfoundations/open_clip"; + license = licenses.asl20; + maintainers = with maintainers; [ iynaix ]; + mainProgram = "open-clip"; + }; +} diff --git a/pkgs/development/python-modules/webdataset/default.nix b/pkgs/development/python-modules/webdataset/default.nix new file mode 100644 index 000000000000..7a29f5e5786f --- /dev/null +++ b/pkgs/development/python-modules/webdataset/default.nix @@ -0,0 +1,83 @@ +{ lib +, stdenv +, buildPythonPackage +, braceexpand +, imageio +, lmdb +, msgpack +, numpy +, pytestCheckHook +, pyyaml +, setuptools +, torch +, torchvision +, wheel +, fetchFromGitHub +}: +buildPythonPackage rec { + pname = "webdataset"; + version = "0.2.79"; + pyproject = true; + + src = fetchFromGitHub { + owner = "webdataset"; + repo = "webdataset"; + rev = version; + hash = "sha256-EfQoHlJ+1spQWZkjS1hwERVUHfjGHDFxE0D+VLujJW8="; + }; + + nativeBuildInputs = [ + setuptools + wheel + ]; + + propagatedBuildInputs = [ + braceexpand + numpy + pyyaml + ]; + + nativeCheckInputs = [ + pytestCheckHook + imageio + torch + torchvision + msgpack + lmdb + ]; + + pythonImportsCheck = [ "webdataset" ]; + + disabledTests = [ + # requires network + "test_batched" + "test_dataloader" + "test_decode_handlers" + "test_decoder" + "test_decoder" + "test_download" + "test_handlers" + "test_pipe" + "test_shard_syntax" + "test_torchvision" + "test_torchvision" + "test_unbatched" + "test_yaml3" + ] ++ lib.optionals stdenv.isDarwin [ + # pickling error + "test_background_download" + ] ++ lib.optionals (stdenv.isAarch64 && stdenv.isLinux) [ + # segfaults on aarch64-linux + "test_webloader" + "test_webloader2" + "test_webloader_repeat" + "test_webloader_unbatched" + ]; + + meta = with lib; { + description = "A high-performance Python-based I/O system for large (and small) deep learning problems, with strong support for PyTorch"; + homepage = "https://github.com/webdataset/webdataset"; + license = licenses.bsd3; + maintainers = with maintainers; [ iynaix ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 029b74d824af..a5c05d2b2655 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8546,6 +8546,8 @@ self: super: with self; { opcua-widgets = callPackage ../development/python-modules/opcua-widgets { }; + open-clip-torch = callPackage ../development/python-modules/open-clip-torch { }; + open-garage = callPackage ../development/python-modules/open-garage { }; open-meteo = callPackage ../development/python-modules/open-meteo { }; @@ -15785,6 +15787,8 @@ self: super: with self; { webcolors = callPackage ../development/python-modules/webcolors { }; + webdataset = callPackage ../development/python-modules/webdataset { }; + webdav4 = callPackage ../development/python-modules/webdav4 { }; webdavclient3 = callPackage ../development/python-modules/webdavclient3 { };