This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired by https://github.com/vpenso/ganglia-sensors/blob/master/lib/python_modules/infiniband.py#/ | |
import logging | |
import re | |
import sys | |
import json | |
import time | |
import subprocess |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf8 | |
import json | |
import torch | |
import argparse | |
import whisper | |
from whisper import Whisper, ModelDimensions | |
from torch.utils.data import Dataset, DataLoader | |
from lightning import Trainer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf8 | |
import logging | |
import torch | |
import torch.distributed | |
from torch.distributed import ReduceOp | |
def print_rank_0(msg, *args, **kwargs): | |
rank = torch.distributed.get_rank() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf8 | |
import math | |
import torch | |
import torch.nn as nn | |
class MultiHeadAttention(nn.Module): | |
def __init__(self, n_feat, n_head=4): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf8 | |
import os | |
import torch | |
import torch.distributed as dist | |
import torch.multiprocessing as mp | |
def cm_broadcast_object_demo(rank: int, world_size: int): | |
dist.init_process_group("gloo", world_size=world_size, rank=rank) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf8 | |
import os | |
import time | |
import random | |
import contextlib | |
import torch | |
import torch.nn as nn | |
import torch.optim as optim | |
import torch.distributed as dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l = [[1, 1675, 4028, 8271, 42, 2], [1, 1675, 4028, 8844, 10135, 10757, 9478, 42, 2]] | |
# maximum rows and columns | |
max_rows = len(l) | |
max_cols = max(len(row) for row in l) | |
# padded rows | |
padded = [row + [0] * (max_cols - len(row)) for row in l] | |
# unpack nested list |