gitarsenal-cli 1.7.5 → 1.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/python/cuda_image_options.py +0 -124
package/package.json
CHANGED
@@ -1,124 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
"""
|
3
|
-
Alternative CUDA image options for GitArsenal CLI
|
4
|
-
These images are more stable and less likely to cause segmentation faults
|
5
|
-
"""
|
6
|
-
|
7
|
-
import modal
|
8
|
-
|
9
|
-
def get_stable_cuda_image():
|
10
|
-
"""
|
11
|
-
Get a stable CUDA image that's less likely to cause segmentation faults
|
12
|
-
"""
|
13
|
-
return modal.Image.from_registry("nvidia/cuda:11.8.0-runtime-ubuntu22.04", add_python="3.11")
|
14
|
-
|
15
|
-
def get_lightweight_cuda_image():
|
16
|
-
"""
|
17
|
-
Get a lightweight CUDA image for basic GPU operations
|
18
|
-
"""
|
19
|
-
return modal.Image.from_registry("nvidia/cuda:11.8.0-base-ubuntu22.04", add_python="3.11")
|
20
|
-
|
21
|
-
def get_latest_stable_cuda_image():
|
22
|
-
"""
|
23
|
-
Get the latest stable CUDA image (12.1 instead of 12.4)
|
24
|
-
"""
|
25
|
-
return modal.Image.from_registry("nvidia/cuda:12.1.0-runtime-ubuntu22.04", add_python="3.11")
|
26
|
-
|
27
|
-
def get_minimal_cuda_image():
|
28
|
-
"""
|
29
|
-
Get a minimal CUDA image with just the essentials
|
30
|
-
"""
|
31
|
-
return modal.Image.from_registry("nvidia/cuda:11.8.0-minimal-ubuntu22.04", add_python="3.11")
|
32
|
-
|
33
|
-
def get_custom_cuda_image():
|
34
|
-
"""
|
35
|
-
Create a custom CUDA image with specific optimizations
|
36
|
-
"""
|
37
|
-
return (
|
38
|
-
modal.Image.from_registry("nvidia/cuda:11.8.0-runtime-ubuntu22.04", add_python="3.11")
|
39
|
-
.apt_install(
|
40
|
-
"openssh-server", "sudo", "curl", "wget", "vim", "htop", "git",
|
41
|
-
"python3", "python3-pip", "build-essential", "tmux", "screen", "nano",
|
42
|
-
"gpg", "ca-certificates", "software-properties-common"
|
43
|
-
)
|
44
|
-
.pip_install("uv", "modal", "requests", "openai")
|
45
|
-
.run_commands(
|
46
|
-
# SSH setup
|
47
|
-
"mkdir -p /var/run/sshd",
|
48
|
-
"mkdir -p /root/.ssh",
|
49
|
-
"chmod 700 /root/.ssh",
|
50
|
-
"sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config",
|
51
|
-
"sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config",
|
52
|
-
"sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config",
|
53
|
-
"echo 'ClientAliveInterval 60' >> /etc/ssh/sshd_config",
|
54
|
-
"echo 'ClientAliveCountMax 3' >> /etc/ssh/sshd_config",
|
55
|
-
"ssh-keygen -A",
|
56
|
-
|
57
|
-
# GPU compatibility
|
58
|
-
"echo 'export CUDA_VISIBLE_DEVICES=0' >> /root/.bashrc",
|
59
|
-
"echo 'export NVIDIA_VISIBLE_DEVICES=all' >> /root/.bashrc",
|
60
|
-
"echo 'export NVIDIA_DRIVER_CAPABILITIES=compute,utility' >> /root/.bashrc",
|
61
|
-
|
62
|
-
# Bash prompt
|
63
|
-
"echo 'export PS1=\"\\[\\e[1;32m\\]modal:\\[\\e[1;34m\\]\\w\\[\\e[0m\\]$ \"' >> /root/.bashrc",
|
64
|
-
)
|
65
|
-
)
|
66
|
-
|
67
|
-
# Image selection based on use case
|
68
|
-
CUDA_IMAGE_OPTIONS = {
|
69
|
-
"stable": get_stable_cuda_image,
|
70
|
-
"lightweight": get_lightweight_cuda_image,
|
71
|
-
"latest": get_latest_stable_cuda_image,
|
72
|
-
"minimal": get_minimal_cuda_image,
|
73
|
-
"custom": get_custom_cuda_image,
|
74
|
-
"default": lambda: modal.Image.debian_slim() # No CUDA, most stable
|
75
|
-
}
|
76
|
-
|
77
|
-
def get_cuda_image(option="default"):
|
78
|
-
"""
|
79
|
-
Get a CUDA image based on the specified option
|
80
|
-
|
81
|
-
Args:
|
82
|
-
option (str): One of "stable", "lightweight", "latest", "minimal", "custom", "default"
|
83
|
-
|
84
|
-
Returns:
|
85
|
-
modal.Image: The selected CUDA image
|
86
|
-
"""
|
87
|
-
if option not in CUDA_IMAGE_OPTIONS:
|
88
|
-
print(f"⚠️ Unknown CUDA image option: {option}. Using default.")
|
89
|
-
option = "default"
|
90
|
-
|
91
|
-
return CUDA_IMAGE_OPTIONS[option]()
|
92
|
-
|
93
|
-
def test_cuda_image_stability(image_func, name):
|
94
|
-
"""
|
95
|
-
Test the stability of a CUDA image
|
96
|
-
|
97
|
-
Args:
|
98
|
-
image_func: Function that returns a modal.Image
|
99
|
-
name (str): Name of the image for logging
|
100
|
-
|
101
|
-
Returns:
|
102
|
-
bool: True if image builds successfully
|
103
|
-
"""
|
104
|
-
try:
|
105
|
-
print(f"🧪 Testing {name} CUDA image...")
|
106
|
-
image = image_func()
|
107
|
-
print(f"✅ {name} image created successfully")
|
108
|
-
return True
|
109
|
-
except Exception as e:
|
110
|
-
print(f"❌ {name} image failed: {e}")
|
111
|
-
return False
|
112
|
-
|
113
|
-
if __name__ == "__main__":
|
114
|
-
print("🧪 Testing CUDA image stability...")
|
115
|
-
|
116
|
-
for name, image_func in CUDA_IMAGE_OPTIONS.items():
|
117
|
-
test_cuda_image_stability(image_func, name)
|
118
|
-
|
119
|
-
print("\n📋 CUDA Image Recommendations:")
|
120
|
-
print("• For maximum stability: Use 'default' (no CUDA)")
|
121
|
-
print("• For basic GPU operations: Use 'stable' (CUDA 11.8 runtime)")
|
122
|
-
print("• For minimal GPU support: Use 'minimal' (CUDA 11.8 minimal)")
|
123
|
-
print("• For latest features: Use 'latest' (CUDA 12.1 runtime)")
|
124
|
-
print("• For custom setup: Use 'custom' (CUDA 11.8 with SSH)")
|