forked from TensorStack-AI/TensorStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnvironmentConfig.cs
More file actions
100 lines (88 loc) · 3.48 KB
/
EnvironmentConfig.cs
File metadata and controls
100 lines (88 loc) · 3.48 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using System.Collections.Generic;
using TensorStack.Common;
namespace TensorStack.Python.Config
{
public record EnvironmentConfig
{
public bool IsDebug { get; set; }
public string Directory { get; set; }
public string Environment { get; set; }
public string[] Requirements { get; set; }
public Dictionary<string, string> Variables { get; set; }
public readonly static string[] DefaultRequirements =
[
"typing==3.7.4.3",
"wheel==0.45.1",
"transformers==4.57.3",
"accelerate==1.12.0",
"diffusers@https://github.com/huggingface/diffusers/archive/5570f817da44520d25c053d7da562bd5b2f46989.zip",
"protobuf==6.33.2",
"sentencepiece==0.2.1",
"ftfy==6.3.1",
"scipy==1.16.3",
"peft==0.18.0",
"hf-xet==1.2.0",
"torchsde==0.2.6",
"optimum-quanto==0.2.7",
"gguf==0.17.1",
"av==16.1.0"
];
public static EnvironmentConfig VendorDefault(VendorType vendorType)
{
return vendorType switch
{
VendorType.AMD => DefaultROCM,
VendorType.Nvidia => DefaultCUDA,
_ => DefaultCPU
};
}
public readonly static EnvironmentConfig DefaultCPU = new()
{
Environment = "default-cpu",
Directory = "PythonRuntime",
Requirements = [
"torch==2.9.1",
"torchvaudio==2.9.1",
"torchvision==0.24.1",
..DefaultRequirements,
]
};
public readonly static EnvironmentConfig DefaultCUDA = new()
{
Environment = "default-cuda",
Directory = "PythonRuntime",
Variables = new Dictionary<string, string> {
{"CUDA_VISIBLE_DEVICES", "0,1" },
{"DIFFUSERS_GGUF_CUDA_KERNELS", "true" }
},
Requirements =
[
"--extra-index-url https://download.pytorch.org/whl/cu128",
"torch==2.9.1+cu128",
"torchaudio==2.9.1+cu128",
"torchvision==0.24.1+cu128",
..DefaultRequirements,
]
};
public readonly static EnvironmentConfig DefaultROCM = new()
{
Environment = "default-rocm",
Directory = "PythonRuntime",
Variables = new Dictionary<string, string> {
{"MIOPEN_FIND_MODE", "2" },
{"HIP_VISIBLE_DEVICES", "0,1" },
{"TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL", "1" }
},
Requirements =
[
"https://repo.radeon.com/rocm/windows/rocm-rel-7.2/rocm-7.2.0.dev0.tar.gz",
"https://repo.radeon.com/rocm/windows/rocm-rel-7.2/rocm_sdk_core-7.2.0.dev0-py3-none-win_amd64.whl",
"https://repo.radeon.com/rocm/windows/rocm-rel-7.2/rocm_sdk_devel-7.2.0.dev0-py3-none-win_amd64.whl",
"https://repo.radeon.com/rocm/windows/rocm-rel-7.2/rocm_sdk_libraries_custom-7.2.0.dev0-py3-none-win_amd64.whl",
"https://repo.radeon.com/rocm/windows/rocm-rel-7.2/torch-2.9.1%2Brocmsdk20260116-cp312-cp312-win_amd64.whl",
"https://repo.radeon.com/rocm/windows/rocm-rel-7.2/torchvision-0.24.1%2Brocmsdk20260116-cp312-cp312-win_amd64.whl",
..DefaultRequirements,
]
};
}
}