invokeai: add NixOS option for model precision

This commit is contained in:
Max 2023-03-03 15:33:28 +01:00
parent 6bfc491e80
commit 11ab758490

View file

@ -56,6 +56,12 @@ in
nsfwChecker = mkEnableOption "the NSFW Checker"; nsfwChecker = mkEnableOption "the NSFW Checker";
precision = mkOption {
description = "Set model precision.";
default = "auto";
type = types.enum [ "auto" "float32" "autocast" "float16" ];
};
extraArgs = mkOption { extraArgs = mkOption {
description = "Extra command line arguments."; description = "Extra command line arguments.";
default = []; default = [];
@ -74,6 +80,7 @@ in
"--root_dir" cfg.dataDir "--root_dir" cfg.dataDir
"--max_loaded_models" cfg.maxLoadedModels "--max_loaded_models" cfg.maxLoadedModels
(yesno cfg.nsfwChecker "nsfw_checker") (yesno cfg.nsfwChecker "nsfw_checker")
"--precision" cfg.precision
] ++ cfg.extraArgs; ] ++ cfg.extraArgs;
initialModelsPath = "${cfg.package}/${cfg.package.pythonModule.sitePackages}/invokeai/configs/INITIAL_MODELS.yaml"; initialModelsPath = "${cfg.package}/${cfg.package.pythonModule.sitePackages}/invokeai/configs/INITIAL_MODELS.yaml";
in mkIf cfg.enable { in mkIf cfg.enable {