Skip to content

Instantly share code, notes, and snippets.

View Microsheep's full-sized avatar

Michael Hsieh Microsheep

View GitHub Profile
@Microsheep
Microsheep / mp_tqdm_utils.py
Created March 17, 2022 04:18
Multiprocessing wrapper with chunking and ETA using tqdm
""" MP_TQDM v4.1 by twmicrosheep
This module is a wrapper for easy multiprocessing with tqdm
"""
import math
import itertools
import multiprocessing
from functools import wraps
from typing import List, Dict, Any, Callable, Iterable, Optional
@Microsheep
Microsheep / experiment.py
Last active March 6, 2023 05:02
W&B config for dataclasses (Python 3.7+)
from datetime import datetime
from dataclasses import dataclass, field, asdict
from typing import Callable, Optional, Dict, Any
import torch
def transform_dict(config_dict: Dict, expand: bool = True):
"""
General function to transform any dictionary into wandb config acceptable format