1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6
7 coqpit,
8 fsspec,
9 torch,
10 tensorboard,
11 protobuf,
12 psutil,
13
14 pytestCheckHook,
15 soundfile,
16 torchvision,
17}:
18
19let
20 pname = "trainer";
21 version = "0.0.36";
22in
23buildPythonPackage {
24 inherit pname version;
25 format = "pyproject";
26
27 src = fetchFromGitHub {
28 owner = "coqui-ai";
29 repo = "Trainer";
30 rev = "refs/tags/v${version}";
31 hash = "sha256-z6TOzWqE3NytkdG3nUzh9GpFVGQEXFyzSQ8gvdB4wiw=";
32 };
33
34 patches = [
35 (fetchpatch {
36 name = "add-support-for-python312.patch";
37 hash = "sha256-V5RPn/2pGKzQrf/SIRU3imo6nBhpBEJpI7HsFYbVZj4=";
38 url = "https://github.com/coqui-ai/Trainer/commit/0278012c7e6f5972b656d11757add4ab89f6d272.patch";
39 })
40 ];
41
42 postPatch = ''
43 sed -i 's/^protobuf.*/protobuf/' requirements.txt
44 '';
45
46 propagatedBuildInputs = [
47 coqpit
48 fsspec
49 protobuf
50 psutil
51 soundfile
52 tensorboard
53 torch
54 ];
55
56 # only one test and that requires training data from the internet
57 doCheck = false;
58
59 nativeCheckInputs = [
60 pytestCheckHook
61 torchvision
62 ];
63
64 pythonImportsCheck = [ "trainer" ];
65
66 meta = with lib; {
67 description = "General purpose model trainer, as flexible as it gets";
68 homepage = "https://github.com/coqui-ai/Trainer";
69 changelog = "https://github.com/coqui-ai/Trainer/releases/tag/v${version}";
70 license = licenses.asl20;
71 maintainers = teams.tts.members;
72 };
73}