(define-module (rclip) #:use-module (gnu packages protobuf) #:use-module (gnu packages check) #:use-module (gnu packages python) #:use-module (gnu packages python-check) #:use-module (gnu packages python-build) #:use-module (gnu packages python-xyz) #:use-module (gnu packages python-web) #:use-module (gnu packages python-crypto) #:use-module (gnu packages machine-learning) #:use-module (gnu packages rust) #:use-module (gnu packages rust-apps) #:use-module (gnu packages crates-io) #:use-module (guix build-system python) #:use-module (guix build-system pyproject) #:use-module (guix build-system cargo) #:use-module (guix build utils) #:use-module (guix git-download) #:use-module (guix packages) #:use-module (guix gexp) #:use-module (guix download) #:use-module ((guix licenses) :prefix license:) ) (define-public poetry-plugin-export (package (name "poetry-plugin-export") (version "1.7.1") (source (origin (method url-fetch) (uri (pypi-uri "poetry_plugin_export" version)) (sha256 (base32 "0bp2640l7v9digjccj0wz086s1xa4hdbrcvdpa84544a46vcyqng")))) (build-system pyproject-build-system) (propagated-inputs (list python-poetry-core-1.9.0)) (home-page "https://python-poetry.org/") (synopsis "Poetry plugin to export the dependencies to various formats") (description "Poetry plugin to export the dependencies to various formats") (license license:expat))) (define-public python-poetry-core-1.9.0 (package (inherit python-poetry-core) (name "python-poetry-core") (version "1.9.0") )) (define-public poetry-1.8.2 (package (inherit poetry) (name "poetry") (version "1.8.2") )) (define-public poetry-1.3 (package (inherit poetry) (name "poetry") (version "1.3") )) (define-public python-installer (package (name "python-installer") (version "0.7.0") (source (origin (method url-fetch) (uri (pypi-uri "installer" version)) (sha256 (base32 "0cdnqh3a3amw8k4s1pzfjh0hpvzw4pczgl702s1b16r82qqkwvd2")))) (build-system pyproject-build-system) (inputs (list python-flit-core)) (home-page "") (synopsis "A library for installing Python wheels.") (description "This package provides a library for installing Python wheels.") (license #f))) (define-public python-rclip (package (name "rclip") (version "1.7.26") (source (origin (method url-fetch) (uri (pypi-uri "rclip" version)) (sha256 (base32 "0q42fl2kx6j2lvm8f6dqy8lr9i8njgb00ywmzxfgz93b6gyf1npz")))) (build-system pyproject-build-system) (propagated-inputs (list python-open-clip-torch python-pillow python-requests python-pytorch python-torchvision python-tqdm python-poetry-core-1.9.0 python-ftfy ;poetry-1.8.2 )) (arguments '( #:phases (modify-phases %standard-phases (delete 'check) ;#TODO: see why this is broke (delete 'sanity-check) ;TODO: Fix broken sanity-check ))) (home-page "https://github.com/yurijmikhalevich/rclip") (synopsis "AI-Powered Command-Line Photo Search Tool") (description "AI-Powered Command-Line Photo Search Tool") (license license:expat))) (define-public python-open-clip-torch (package (name "python-open-clip-torch") (version "2.24.0") ;(source ; (origin ; (method url-fetch) ; (uri (pypi-uri "open_clip_torch" version)) ; (sha256 ; (base32 "1zqr08ci6fpsvgi5q2329hgd630bbxrlx2pbk71jff1ixqm4iqhs")))) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/mlfoundations/open_clip") (commit (string-append "v" version)) )) (file-name (git-file-name name version)) (sha256 (base32 "0mby632z2qpahb8pd8cmn14bz4w1q0cngz7s6rmx2qwfg2fxf1ms")))) (build-system pyproject-build-system) (inputs (list python-ftfy python-huggingface-hub python-protobuf python-regex python-sentencepiece python-timm python-pytorch python-torchvision python-tqdm python-wheel )) (arguments '( #:phases (modify-phases %standard-phases (delete 'check) ;Networking required for checks, so disable them (delete 'sanity-check) ;TODO: Fix broken sanity-check ))) (home-page "https://github.com/mlfoundations/open_clip") (synopsis "OpenCLIP") (description "@code{OpenCLIP}") (license #f))) (define-public python-ftfy (package (name "python-ftfy") ;(version "6.2.0") (version "5.5.1") (source (origin (method url-fetch) (uri (pypi-uri "ftfy" version)) (sha256 ;(base32 "1h3m9i1c2qp874fpg62gcp39yqdhc5mrsqd29ja9gvr5f0y18hjy")))) (base32 "1ci6xrj4g01a97nymxpv9nj820nlmgzc4ybaz9k46i6bnxzpax7s")))) (build-system pyproject-build-system) (native-inputs (list poetry)) (propagated-inputs (list python-wcwidth)) (arguments '( #:phases (modify-phases %standard-phases (delete 'check) ))) (home-page "") (synopsis "Fixes mojibake and other problems with Unicode, after the fact") (description "Fixes mojibake and other problems with Unicode, after the fact") (license license:asl2.0))) (define-public python-expecttest (package (name "python-expecttest") (version "0.2.1") (source (origin (method url-fetch) (uri (pypi-uri "expecttest" version)) (sha256 (base32 "1xbkpcp3477ccgr4ks16v0j22i7a939bs2rajvk0cigqlvw1qaz5")))) (build-system pyproject-build-system) (arguments (list #:phases #~(modify-phases %standard-phases (delete 'check)))) (native-inputs (list poetry)) (home-page "https://github.com/ezyang/expecttest") (synopsis "") (description "") (license license:expat))) (define-public python-timm (package (name "python-timm") (version "0.9.16") (source (origin (method url-fetch) (uri (pypi-uri "timm" version)) (sha256 (base32 "1rkif1mkgryirn78aw9rkwplf3hzfqbw3c0slwqxynnmfprm87l9")))) (build-system pyproject-build-system) (arguments (list #:phases #~(modify-phases %standard-phases (delete 'check) ;takes FOREVER for some reason (delete 'sanity-check ;Crashes; #TODO: fix this )))) (inputs (list python-huggingface-hub python-pyyaml python-safetensors python-pytorch python-torchvision python-pdm-backend python-pytest python-pytest-timeout python-expecttest python-pytest-xdist)) (home-page "https://github.com/huggingface/pytorch-image-models") (synopsis "PyTorch Image Models") (description "@code{PyTorch} Image Models") (license license:asl2.0))) (define-public rust-memmap2-0.5 (package (name "rust-memmap2") (version "0.5.0") (source (origin (method url-fetch) (uri (crate-uri "memmap2" version)) (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 "0vp9pxd20gyq8196v73chxdw6gfxz3g4lkdkvffd5slgawds2is6")))) (build-system cargo-build-system) (arguments `(#:cargo-inputs (("rust-libc" ,rust-libc-0.2) ("rust-stable-deref-trait" ,rust-stable-deref-trait-1)) #:cargo-development-inputs (("rust-owning-ref" ,rust-owning-ref-0.4) ("rust-tempdir" ,rust-tempdir-0.3)))) (home-page "https://github.com/RazrFalcon/memmap2-rs") (synopsis "Cross-platform Rust API for memory-mapped file IO") (description "Cross-platform Rust API for memory-mapped file IO") (license (list license:expat license:asl2.0)))) (define-public rust-safetensors-0.4 (package (name "rust-safetensors") (version "0.4.2") (source (origin (method url-fetch) (uri (crate-uri "safetensors" version)) (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 "1vb9wsmsm7wfyvkl795wpc2iiwa3mx0vqhhym2q6yhrlzdmhx64d")))) (build-system cargo-build-system) (arguments `(#:cargo-inputs (("rust-serde" ,rust-serde-1) ("rust-serde-json" ,rust-serde-json-1)) #:cargo-development-inputs (("rust-criterion" ,rust-criterion-0.4) ("rust-memmap2" ,rust-memmap2-0.5) ("rust-proptest" ,rust-proptest-1)))) (home-page "https://github.com/huggingface/safetensors") (synopsis "Provides functions to read and write safetensors which aim to be safer than their PyTorch counterpart. The format is 8 bytes which is an unsized int, being the size of a JSON header, the JSON header refers the `dtype` the `shape` and `data_offsets` which are the offsets for the values in the rest of the file. ") (description "This package provides functions to read and write safetensors which aim to be safer than their @code{PyTorch} counterpart. The format is 8 bytes which is an unsized int, being the size of a JSON header, the JSON header refers the `dtype` the `shape` and `data_offsets` which are the offsets for the values in the rest of the file.") (license license:asl2.0))) (define-public python-safetensors (package (name "python-safetensors") (version "0.4.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/huggingface/safetensors.git") (commit (string-append "v" version)) )) (file-name (git-file-name name version)) (sha256 (base32 "1gs0ivd5m95jyy6j1yqvm8pq068xsk405gv0nwq2821vr4ix9lw5")))) (build-system cargo-build-system) (arguments (list #:imported-modules `(,@%cargo-build-system-modules ,@%pyproject-build-system-modules) #:modules '((guix build cargo-build-system) ((guix build pyproject-build-system) #:prefix py:) (guix build utils)) #:phases #~(modify-phases %standard-phases (add-before 'configure 'get-safetensor-cargo (lambda _ (copy-recursively "bindings/python/Cargo.toml" "./Cargo.toml") (substitute* "./Cargo.toml" ( ("name = \"safetensors_rust\"") "name = \"safetensors_rust\"\npath = \"bindings/python//src/lib.rs\"" ) ) (substitute* "./Cargo.toml" ( ("path = \"../../safetensors\"") "path = \"safetensors\"" ) ) )) (add-after 'prepare-python-module 'build-python-module (assoc-ref py:%standard-phases 'build)) (add-after 'build-python-module 'install-python-module (assoc-ref py:%standard-phases 'install)) (add-after 'compress-documentation 'remove-bloat (lambda _ (delete-file-recursively "target") (delete-file-recursively "attacks") (delete-file-recursively "safetensors") )) ) #:cargo-inputs `( ;("rust-safetensors" ,rust-safetensors-0.4) ("rust-pyo3" ,rust-pyo3-0.20) ("rust-criterion" ,rust-criterion-0.5) ("rust-memmap2" ,rust-memmap2-0.5) ("rust-proptest" ,rust-proptest-1) ("rust-serde" ,rust-serde-1) ("rust-serde-json" ,rust-serde-json-1) ) #:install-source? #false)) (inputs (list maturin rust-safetensors-0.4 python-wheel)) (native-inputs (list python-wrapper)) (home-page "https://github.com/huggingface/safetensors") (synopsis "a new simple format for storing tensors safely") (description "This repository implements a new simple format for storing tensors safely (as opposed to pickle) and that is still fast (zero-copy).") (license license:asl2.0))) ;(define-public python-safetensors ; (package ; (name "python-safetensors") ; (version "0.4.2") ; (source ; (origin ; (method url-fetch) ; (uri (pypi-uri "safetensors" version)) ; (sha256 ; (base32 "0wxcij5hxk4jgphn1w2g3vrh7ham9nnxg27mhykqlppc175mvj5c")))) ; (build-system pyproject-build-system) ; (native-inputs (list python-h5py ; python-huggingface-hub ; python-hypothesis ; python-pytest ; python-pytest-benchmark ; python-setuptools-rust ; rust ; rust-cargo ; maturin ; ; ;Dev Deps ; rust-criterion-0.5 ; ;rust-memmap2-0.5 ; rust-proptest-1 ; )) ; (inputs (list rust-serde-1 rust-serde-json-1)) ; (arguments ; '( #:phases ; (modify-phases %standard-phases ; (add-before 'build 'use-maturin-offline ; (lambda _ ; ; (substitute* "pyproject.toml" ( ("bindings = 'pyo3'") "bindings = 'pyo3'\ncargo-extra-args=[\"--offline --locked --frozen\"]" ) ) ) ; )) ; )) ; (home-page "") ; (synopsis "") ; (description "") ; (license #f))) ;