1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # dependencies
7 ftfy,
8 regex,
9 tqdm,
10 torch,
11 torchvision,
12
13 # tests
14 pytestCheckHook,
15}:
16
17buildPythonPackage rec {
18 pname = "clip-anytorch";
19 version = "2.6.0";
20 format = "setuptools";
21
22 src = fetchFromGitHub {
23 owner = "rom1504";
24 repo = "CLIP";
25 rev = "refs/tags/${version}";
26 hash = "sha256-4A8R9aEiOWC05uhMQslhVSkQ4hyjs6VsqkFi76miodY=";
27 };
28
29 propagatedBuildInputs = [
30 ftfy
31 regex
32 tqdm
33 torch
34 torchvision
35 ];
36
37 pythonImportsCheck = [ "clip" ];
38
39 # all tests require network access
40 doCheck = false;
41
42 nativeCheckInputs = [ pytestCheckHook ];
43
44 preCheck = ''
45 export HOME=$TMPDIR
46 '';
47
48 meta = with lib; {
49 description = "Contrastive Language-Image Pretraining";
50 homepage = "https://github.com/rom1504/CLIP";
51 license = licenses.mit;
52 maintainers = teams.tts.members;
53 };
54}