Files
nixpkgs/pkgs/development/python-modules/finetuning-scheduler/default.nix
T
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

64 lines
1.8 KiB
Nix

{
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.hostPlatform.isAarch64 && stdenv.hostPlatform.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.hostPlatform.isDarwin;
};
}