def plot_data(prefix):
    """Plot the data from the CSV file.
    Args:
        prefix: The prefix of the CSV file.
    """
    data = list(csv.reader(open(f"{prefix}.csv")))
    if len(data) < 2:
        print("Insufficient data for plotting.")
        return

    time_stamps, used_memory, gpu_utilization = zip(*data[1:])
    used_memory = [float(x) for x in used_memory]
    gpu_utilization = [float(x) for x in gpu_utilization]
    if len(used_memory) >= 10:
        tick_spacing = len(used_memory) // 10
    else:
        tick_spacing = 1

    try:
        plot_graph(
            time_stamps,
            used_memory,
            "Used Memory (GB)",
            "Time",
            "Used Memory (GB)",
            "Used Memory Over Time",
            tick_spacing,
            f"{prefix}_memory.png",
        )
    except Exception as e:
        message = f"plot_graph of Memory error, error info:{str(e)}"
        print(message)

    try:
        plot_graph(
            time_stamps,
            gpu_utilization,
            "GPU Utilization (%)",
            "Time",
            "GPU Utilization (%)",
            "GPU Utilization Over Time",
            tick_spacing,
            f"{prefix}_utilization.png",
        )
    except Exception as e:
        message = f"plot_graph of Utilization error, error info:{str(e)}"
        print(message)
Plot the data from the CSV file.
    Args:
        prefix: The prefix of the CSV file.
    
scripts/train_kohya/utils/gpu_info.py