This file contains hidden or 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
| from typing import Dict, Union | |
| from huggingface_hub import get_safetensors_metadata | |
| import argparse | |
| import sys | |
| # Example: | |
| # python get_gpu_memory.py Qwen/Qwen2.5-7B-Instruct | |
| # Dictionary mapping dtype strings to their byte sizes | |
| bytes_per_dtype: Dict[str, float] = { |
This file contains hidden or 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
| import os | |
| import platform | |
| from typing import Optional | |
| from urllib.error import HTTPError | |
| from warnings import warn | |
| from pytorch_lightning import LightningDataModule | |
| from pytorch_lightning.utilities.imports import _TORCHVISION_AVAILABLE | |
| from torch.utils.data import DataLoader, random_split |
This file contains hidden or 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
| import pytorch_lightning as pl | |
| import torch | |
| from pytorch_lightning.loggers.tensorboard import TensorBoardLogger | |
| from pytorch_lightning.trainer.trainer import Trainer | |
| from torch.nn import functional as F | |
| from mnist_datamodule import MNISTDataModule | |
| pl.seed_everything(42) |
This file contains hidden or 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
| from typing import IO | |
| import requests | |
| from requests.exceptions import RequestException | |
| from tqdm import tqdm | |
| def download_file(url: str, tmp_file: IO) -> None: | |
| try: | |
| r = requests.get(url) |