about summary refs log tree commit diff
path: root/pkgs/development/python-modules/finetuning-scheduler/default.nix
blob: 7d9cf816c7ba5e560705a8b219a9082ce14590e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
  stdenv,
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  pythonOlder,
  pytestCheckHook,
  torch,
  pytorch-lightning,
}:

buildPythonPackage rec {
  pname = "finetuning-scheduler";
  version = "2.4.0";
  pyproject = true;

  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "speediedan";
    repo = "finetuning-scheduler";
    rev = "refs/tags/v${version}";
    hash = "sha256-uSFGZseSJv519LpaddO6yP6AsIMZutEA0Y7Yr+mEWTQ=";
  };

  build-system = [ setuptools ];

  dependencies = [
    pytorch-lightning
    torch
  ];

  # needed while lightning is installed as package `pytorch-lightning` rather than`lightning`:
  env.PACKAGE_NAME = "pytorch";

  nativeCheckInputs = [ pytestCheckHook ];
  pytestFlagsArray = [ "tests" ];
  disabledTests =
    # torch._dynamo.exc.BackendCompilerFailed: backend='inductor' raised:
    # LoweringException: ImportError: cannot import name 'triton_key' from 'triton.compiler.compiler'
    lib.optionals (pythonOlder "3.12") [
      "test_fts_dynamo_enforce_p0"
      "test_fts_dynamo_resume"
      "test_fts_dynamo_intrafit"
    ]
    ++ lib.optionals (stdenv.isAarch64 && stdenv.isLinux) [
      # slightly exceeds numerical tolerance on aarch64-linux:
      "test_fts_frozen_bn_track_running_stats"
    ];

  pythonImportsCheck = [ "finetuning_scheduler" ];

  meta = {
    description = "PyTorch Lightning extension for foundation model experimentation with flexible fine-tuning schedules";
    homepage = "https://finetuning-scheduler.readthedocs.io";
    changelog = "https://github.com/speediedan/finetuning-scheduler/blob/${src.rev}/CHANGELOG.md";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ bcdarwin ];
    # "No module named 'torch._C._distributed_c10d'; 'torch._C' is not a package" at import time:
    broken = stdenv.isDarwin;
  };
}