File size: 1,236 Bytes
4f48282
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

import modal
import sys
import os
import random
from datetime import datetime
import random
import io

# Create a Modal app
app = modal.App("ctb-image-generator")

volume = modal.Volume.from_name("flux-model-vol")  # Reference your volume

@app.function(
    #gpu="t4",  # No GPU needed for debugging volume
    volumes={"/model": volume}  # Replace `volume` with your actual volume name if needed
)
def debug_volume():
    import os

    # Directory to check inside the container
    model_dir = "/model"

    try:
        if os.path.exists(model_dir):
            print(f"Volume successfully mounted at: {model_dir}")
            print("Files and directories in the mounted volume:")

            # List files in the mounted directory
            for root, dirs, files in os.walk(model_dir):
                print(f"Root: {root}")
                for dir_name in dirs:
                    print(f"  Directory: {dir_name}")
                for file_name in files:
                    print(f"  File: {file_name}")
        else:
            print(f"Volume not found at: {model_dir}")
            print("Ensure the volume is correctly mounted and mapped.")
    except Exception as e:
        print(f"Error while accessing volume: {e}")