File size: 690 Bytes
4643f62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Check Modal can give us a GPU and read the Hugging Face secret. Run: modal run scripts/modal_smoke.py"""
import modal

app = modal.App("slm-training-smoke")


@app.function(gpu="L40S", timeout=300, secrets=[modal.Secret.from_name("huggingface")])
def gpu_info():
    import os
    import subprocess

    gpu = subprocess.run(
        ["nvidia-smi", "--query-gpu=name,memory.total", "--format=csv,noheader"],
        capture_output=True, text=True,
    ).stdout.strip()
    return gpu, bool(os.environ.get("HF_TOKEN"))


@app.local_entrypoint()
def main():
    gpu, has_token = gpu_info.remote()
    print(f"GPU: {gpu} | HF_TOKEN visible in container: {has_token}")