1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 ftfy,
7 packaging,
8 pythonOlder,
9 regex,
10 setuptools,
11 torch,
12 torchvision,
13 tqdm,
14}:
15
16buildPythonPackage rec {
17 pname = "clip-anytorch";
18 version = "2.6.0";
19 pyproject = true;
20
21 disabled = pythonOlder "3.10";
22
23 src = fetchFromGitHub {
24 owner = "rom1504";
25 repo = "CLIP";
26 tag = version;
27 hash = "sha256-4A8R9aEiOWC05uhMQslhVSkQ4hyjs6VsqkFi76miodY=";
28 };
29
30 patches = [
31 # Import packaging to be compatible with setuptools==70.0.0, https://github.com/rom1504/CLIP/pull/10
32 (fetchpatch {
33 name = "setuptools-comp.patch";
34 url = "https://github.com/rom1504/CLIP/pull/10/commits/8137d899035d889623f6b0a0a0faae88c549dc50.patch";
35 hash = "sha256-CIcuDk4QH+0g8YEa6TbKGjIcKJQqFviymVH68sKmsyk=";
36 })
37 ];
38
39 build-system = [ setuptools ];
40
41 dependencies = [
42 ftfy
43 regex
44 packaging
45 tqdm
46 torch
47 torchvision
48 ];
49
50 pythonImportsCheck = [ "clip" ];
51
52 # All tests require network access
53 doCheck = false;
54
55 meta = with lib; {
56 description = "Contrastive Language-Image Pretraining";
57 homepage = "https://github.com/rom1504/CLIP";
58 license = licenses.mit;
59 teams = [ teams.tts ];
60 };
61}