repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/model_utils.py
src/utils/model_utils.py
import torch # noinspection PyProtectedMember from torch.nn.modules.batchnorm import _BatchNorm def get_paramnames_with_no_gradient(model): return [name for name, param in model.named_parameters() if param.grad is None and param.requires_grad] def get_output_shape_of_model(model, forward_fn, **forward_kwargs): ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/checkpoint.py
src/utils/checkpoint.py
import functools import math import os import re @functools.total_ordering class Checkpoint: def __init__(self, epoch=None, update=None, sample=None): self.epoch = epoch self.update = update self.sample = sample def copy(self): return Checkpoint(epoch=self.epoch, update=self.u...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/pytorch_cuda_timing.py
src/utils/pytorch_cuda_timing.py
import torch import torch.distributed as dist def cuda_start_event(): start_event = torch.cuda.Event(enable_timing=True) start_event.record() return start_event def cuda_end_event(start_event): if dist.is_available() and dist.is_initialized(): torch.cuda.synchronize() dist.barrier() ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/log_once.py
src/utils/log_once.py
import logging _MESSAGE_KEYS = set() def log_once(log_fn_or_message, key, level=logging.INFO): if key not in _MESSAGE_KEYS: if isinstance(log_fn_or_message, str): logging.log(level=level, msg=log_fn_or_message) else: log_fn_or_message() _MESSAGE_KEYS.add(key)
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/save_image_utils.py
src/utils/save_image_utils.py
import einops import numpy as np import torch from PIL import Image from kappadata import get_denorm_transform, get_norm_transform from kappadata.wrappers import XTransformWrapper from matplotlib.pyplot import get_cmap from torchvision.transforms.functional import to_pil_image # region concat images def concat_images...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/update_counter.py
src/utils/update_counter.py
from utils.checkpoint import Checkpoint class UpdateCounter: def __init__( self, start_checkpoint: Checkpoint, end_checkpoint: Checkpoint, updates_per_epoch: int, effective_batch_size: int, ): self.updates_per_epoch = updates_per_epoch ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/factory.py
src/utils/factory.py
import importlib import inspect import logging from functools import partial from itertools import product def create(obj_or_kwargs, from_kwargs_fn, instantiate_if_ctor=True, **kwargs): """ avoid boilerplate code when allowing ctor arguments to be either an object or a dict with the object parameters e.g....
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/memory_leak_util.py
src/utils/memory_leak_util.py
import gc import torch def get_tensors_in_memory(): # some warning was thrown when calling torch.is_tensor(_reduce_op) with a _reduce_op object all_objs = gc.get_objects() all_tensors = [] cuda_tensors = [] for obj in all_objs: try: if type(obj).__name__ != "_reduce_op" and to...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/__init__.py
src/utils/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/vit_util.py
src/utils/vit_util.py
import einops from .param_checking import to_2tuple def get_sequence_lengths(input_shape, patch_size): assert len(input_shape) == len(patch_size) ndim = len(patch_size) assert all(input_shape[i] % patch_size[i] == 0 for i in range(ndim)) seqlens = [input_shape[i] // patch_size[i] for i in range(ndim)...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/select_with_path.py
src/utils/select_with_path.py
def select_with_path(obj, path): if path is not None: for p in path.split("."): if isinstance(obj, dict): obj = obj[p] elif isinstance(obj, list): obj = obj[int(p)] else: obj = getattr(obj, p) return obj
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/infer_higher_is_better.py
src/utils/infer_higher_is_better.py
import logging LOWER_IS_BETTER_KEYS = [ "loss", "delta", ] HIGHER_IS_BETTER_KEYS = [ "profiling/train_update_time", "correlation", "corerlation_time", ] NEUTRAL_KEYS = [ "optim", "profiling", "mask_ratio", "freezers", "transform_scale", "ctx", "loss_weight", "gradien...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/apply_transform_dataset.py
src/utils/apply_transform_dataset.py
from torch.utils.data import Dataset class ApplyTransformDataset(Dataset): """ helper dataset to apply a transform in parallel fashion to some data applying transforms via the pytorch DataLoader is much faster than applying it via joblib (on ImageNet10-M3AE logging embeddings of a ViT-B takes 10:40 wi...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/formatting_util.py
src/utils/formatting_util.py
import numpy as np import torch _SI_PREFIXES = ["", "K", "M", "G", "T", "P", "E"] def short_number_str(number, precision=1): if number == 0: return "{short_number:.{precision}f}".format(short_number=0., precision=precision) if number < 0: number = -number sign = "-" else: ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/version_check.py
src/utils/version_check.py
import logging import sys import packaging.version expected_torch = "2.0.0" expected_torchvision = "0.15.0" expected_kappabenchmark = "0.0.10" expected_kappaconfig = "1.0.29" expected_kappadata = "1.3.78" expected_kappamodules = "0.1.24" expected_kappaprofiler = "1.0.11" expected_kappaschedules = "0.0.18" expected_ti...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/invariance_utils.py
src/utils/invariance_utils.py
import torch from torch.nn.functional import softmax # Method to calculate the invariance of the latent space representations # Eq.6 in https://openreview.net/pdf?id=SCD0hn3kMHw # features_no_aug.shape = (N,d) # feature_dict_augs: each key represents an original sample -> number of keys = N # each ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/knn_predict.py
src/utils/knn_predict.py
import einops import torch import torch.nn.functional as F @torch.no_grad() def knn_predict(train_x, train_y, test_x, k=10, tau=0.07, batch_normalize=True, eps=1e-6): # initialize onehot vector per class (used for counting votes in classification) n_classes = train_y.max().item() + 1 if n_classes <= 1: ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/commands/copy_command.py
src/utils/commands/copy_command.py
from pathlib import Path from .base.command_base import CommandBase class CopyCommand(CommandBase): def __init__(self, src: str, dst: str, **kwargs): super().__init__(**kwargs) self.src = Path(self._resolve_string(src)).expanduser() self.dst = Path(self._resolve_string(dst)).expanduser() ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/commands/__init__.py
src/utils/commands/__init__.py
from utils.factory import instantiate def command_from_kwargs(kind, **kwargs): return instantiate( module_names=[f"utils.commands.{kind}"], type_names=[kind.split(".")[-1]], **kwargs )
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/commands/copy_yaml_command.py
src/utils/commands/copy_yaml_command.py
from pathlib import Path import yaml from .base.command_base import CommandBase class CopyYamlCommand(CommandBase): def __init__(self, src: str, dst: str, prepend: dict = None, **kwargs): super().__init__(**kwargs) self.src = Path(self._resolve_string(src)).expanduser() self.dst = Path(s...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/commands/base/command_base.py
src/utils/commands/base/command_base.py
import logging class CommandBase: def __init__(self, stage_id, variables=None): self.logger = logging.getLogger(type(self).__name__) self.stage_id = stage_id self.variables = variables or {} self.variables["stage_id"] = self.stage_id def __repr__(self): return str(self...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/commands/base/__init__.py
src/utils/commands/base/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/kappaconfig/schedule_template_postprocessor.py
src/utils/kappaconfig/schedule_template_postprocessor.py
import kappaconfig as kc from utils.param_checking import to_2tuple from .testrun_constants import TEST_RUN_EFFECTIVE_BATCH_SIZE, TEST_RUN_UPDATES_PER_EPOCH # TODO workaround for missing feature of KappaConfig to enable list objects as template class ScheduleTemplatePostProcessor(kc.Processor): """ resolves n...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/kappaconfig/minmodel_postprocessor.py
src/utils/kappaconfig/minmodel_postprocessor.py
import kappaconfig as kc class MinModelPostProcessor(kc.Processor): def preorder_process(self, node, trace): if len(trace) == 0: return if isinstance(node, dict): if "initializers" in node: i = 0 while i < len(node["initializers"]): ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/kappaconfig/mindata_preprocessor.py
src/utils/kappaconfig/mindata_preprocessor.py
import kappaconfig as kc from kappaconfig.entities.wrappers import KCScalar class MinDataPreProcessor(kc.Processor): def preorder_process(self, node, trace): if len(trace) == 0: return parent, parent_accessor = trace[-1] if isinstance(parent_accessor, str): # datase...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/kappaconfig/util.py
src/utils/kappaconfig/util.py
import logging import shutil from pathlib import Path import kappaconfig as kc import yaml from utils.factory import create_collection from utils.processors import processor_from_kwargs from .mindata_postprocessor import MinDataPostProcessor from .mindata_preprocessor import MinDataPreProcessor from .minduration_post...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/kappaconfig/remove_large_collections_postprocessor.py
src/utils/kappaconfig/remove_large_collections_postprocessor.py
import kappaconfig as kc class RemoveLargeCollectionsProcessor(kc.Processor): """ remove large list/dicts for prettier storing of the resolved yaml """ def preorder_process(self, node, trace): if len(trace) == 0: return parent, parent_accessor = trace[-1] if isinst...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/kappaconfig/minduration_postprocessor.py
src/utils/kappaconfig/minduration_postprocessor.py
import kappaconfig as kc from .testrun_constants import TEST_RUN_EPOCHS, TEST_RUN_UPDATES, TEST_RUN_SAMPLES, TEST_RUN_EFFECTIVE_BATCH_SIZE class MinDurationPostProcessor(kc.Processor): """ limit training duration to a minimum by maniuplating the configuration yaml """ def preorder_process(self, node, trace)...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/kappaconfig/none_postprocessor.py
src/utils/kappaconfig/none_postprocessor.py
import kappaconfig as kc class NonePostProcessor(kc.Processor): def preorder_process(self, node, trace): if len(trace) == 0: return if isinstance(node, str) and node.lower() == "none": parent, accessor = trace[-1] parent[accessor] = None
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/kappaconfig/precision_preprocessor.py
src/utils/kappaconfig/precision_preprocessor.py
import kappaconfig as kc from utils.amp_utils import FLOAT32_ALIASES, FLOAT16_ALIASES, BFLOAT16_ALIASES class PrecisionPreProcessor(kc.Processor): def preorder_process(self, node, trace): if len(trace) == 0: return parent, parent_accessor = trace[-1] if isinstance(parent_acces...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/kappaconfig/testrun_constants.py
src/utils/kappaconfig/testrun_constants.py
TEST_RUN_EFFECTIVE_BATCH_SIZE = 8 TEST_RUN_EPOCHS = 2 TEST_RUN_UPDATES_PER_EPOCH = 3 TEST_RUN_UPDATES = TEST_RUN_EPOCHS * TEST_RUN_UPDATES_PER_EPOCH TEST_RUN_SAMPLES = TEST_RUN_UPDATES * TEST_RUN_EFFECTIVE_BATCH_SIZE
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/kappaconfig/__init__.py
src/utils/kappaconfig/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/kappaconfig/mindata_postprocessor.py
src/utils/kappaconfig/mindata_postprocessor.py
import kappaconfig as kc from utils.param_checking import to_2tuple from .testrun_constants import TEST_RUN_EFFECTIVE_BATCH_SIZE, TEST_RUN_UPDATES_PER_EPOCH class MinDataPostProcessor(kc.Processor): """ hyperparams for specific properties in the dictionary and replace it such that the training duration is ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/kappaconfig/minmodel_preprocessor.py
src/utils/kappaconfig/minmodel_preprocessor.py
import kappaconfig as kc from kappaconfig.entities.wrappers import KCScalar class MinModelPreProcessor(kc.Processor): def preorder_process(self, node, trace): if len(trace) == 0: return parent, parent_accessor = trace[-1] if isinstance(parent_accessor, str): if "mod...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/utils/processors/__init__.py
src/utils/processors/__init__.py
from utils.factory import instantiate def processor_from_kwargs(kind, **kwargs): return instantiate( module_names=[f"utils.processors.{kind}"], type_names=[kind], **kwargs, )
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/__init__.py
src/callbacks/__init__.py
from utils.factory import instantiate def callback_from_kwargs(kind, **kwargs): return instantiate( module_names=[ f"callbacks.{kind}", f"callbacks.checkpoint_callbacks.{kind}", f"callbacks.default_callbacks.{kind}", f"callbacks.monitor_callbacks.{kind}", ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_lagrangian_large_t_rollout_mesh_loss_callback.py
src/callbacks/offline_callbacks/offline_lagrangian_large_t_rollout_mesh_loss_callback.py
from torch_geometric.utils import scatter from kappadata.wrappers import ModeWrapper from functools import partial import einops import torch from callbacks.base.periodic_callback import PeriodicCallback from utils.formatting_util import dict_to_string class OfflineLagrangianLargeTRolloutMeshLossCallback(PeriodicCa...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_rollout_mesh_callback.py
src/callbacks/offline_callbacks/offline_rollout_mesh_callback.py
import matplotlib.pyplot as plt import os from torchvision.transforms.functional import to_tensor, to_pil_image from PIL import Image import io from datasets.collators.cfd_simformer_collator import CfdSimformerCollator import scipy from functools import partial import einops import torch from kappadata.wrappers impor...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_rollout_speed_callback.py
src/callbacks/offline_callbacks/offline_rollout_speed_callback.py
import kappaprofiler as kp import einops from functools import partial import torch from kappadata.wrappers import ModeWrapper from callbacks.base.periodic_callback import PeriodicCallback from datasets.collators.cfd_simformer_collator import CfdSimformerCollator class OfflineRolloutSpeedCallback(PeriodicCallback):...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_loss_callback.py
src/callbacks/offline_callbacks/offline_loss_callback.py
import torch from functools import partial from callbacks.base.periodic_callback import PeriodicCallback from utils.object_from_kwargs import objects_from_kwargs class OfflineLossCallback(PeriodicCallback): def __init__( self, dataset_key, output_patterns_to_log=None, ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_rollout_mesh_gif_callback.py
src/callbacks/offline_callbacks/offline_rollout_mesh_gif_callback.py
import matplotlib.pyplot as plt import os from torchvision.transforms.functional import to_tensor, to_pil_image from PIL import Image import io from datasets.collators.cfd_simformer_collator import CfdSimformerCollator import scipy from functools import partial import einops import torch from kappadata.wrappers impor...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_correlation_time_interpolated_callback.py
src/callbacks/offline_callbacks/offline_correlation_time_interpolated_callback.py
import einops from functools import partial import torch from kappadata.wrappers import ModeWrapper from callbacks.base.periodic_callback import PeriodicCallback from datasets.collators.cfd_simformer_collator import CfdSimformerCollator class OfflineCorrelationTimeInterpolatedCallback(PeriodicCallback): def __i...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_lagrangian_large_t_rollout_speed_callback.py
src/callbacks/offline_callbacks/offline_lagrangian_large_t_rollout_speed_callback.py
from torch_geometric.utils import scatter import kappaprofiler as kp from kappadata.wrappers import ModeWrapper from functools import partial import einops import torch from callbacks.base.periodic_callback import PeriodicCallback from utils.formatting_util import dict_to_string class OfflineLagrangianLargeTRollout...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_cfd_rollout_callback.py
src/callbacks/offline_callbacks/offline_cfd_rollout_callback.py
import einops from functools import partial import torch from kappadata.wrappers import ModeWrapper from callbacks.base.periodic_callback import PeriodicCallback from datasets.collators.cfd_simformer_collator import CfdSimformerCollator class OfflineCfdRolloutCallback(PeriodicCallback): def __init__( ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_cfd_rollout_mesh_gif_callback.py
src/callbacks/offline_callbacks/offline_cfd_rollout_mesh_gif_callback.py
import io from functools import partial import einops import torch from PIL import Image from kappadata.wrappers import ModeWrapper from kappautils.images.png import png_writer_viridis from kappautils.images.points_to_image import coords_to_image from callbacks.base.periodic_callback import PeriodicCallback from util...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_pred_callback.py
src/callbacks/offline_callbacks/offline_pred_callback.py
import torch from functools import partial from callbacks.base.periodic_callback import PeriodicCallback from utils.object_from_kwargs import objects_from_kwargs class OfflinePredCallback(PeriodicCallback): def __init__(self, dataset_key, forward_kwargs=None, **kwargs): super().__init__(**kwargs) ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_correlation_time_callback.py
src/callbacks/offline_callbacks/offline_correlation_time_callback.py
import einops from functools import partial import torch from kappadata.wrappers import ModeWrapper from callbacks.base.periodic_callback import PeriodicCallback from datasets.collators.cfd_simformer_collator import CfdSimformerCollator class OfflineCorrelationTimeCallback(PeriodicCallback): def __init__( ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/__init__.py
src/callbacks/offline_callbacks/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_rollout2d_callback.py
src/callbacks/offline_callbacks/offline_rollout2d_callback.py
from functools import partial import einops import torch from kappadata.wrappers import ModeWrapper from kappautils.images.png import png_writer_viridis from torchvision.datasets.folder import default_loader from callbacks.base.periodic_callback import PeriodicCallback from utils.formatting_util import dict_to_string...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_rollout_mesh_loss_callback.py
src/callbacks/offline_callbacks/offline_rollout_mesh_loss_callback.py
from torch_geometric.utils import scatter from kappadata.wrappers import ModeWrapper from functools import partial import einops import torch from callbacks.base.periodic_callback import PeriodicCallback from utils.formatting_util import dict_to_string class OfflineRolloutMeshLossCallback(PeriodicCallback): def...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_lagrangian_rollout_mesh_loss_callback.py
src/callbacks/offline_callbacks/offline_lagrangian_rollout_mesh_loss_callback.py
from torch_geometric.utils import scatter from kappadata.wrappers import ModeWrapper from functools import partial import einops import torch from callbacks.base.periodic_callback import PeriodicCallback from utils.formatting_util import dict_to_string class OfflineLagrangianRolloutMeshLossCallback(PeriodicCallback...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/offline_callbacks/offline_cfd_rollout_mesh_loss_callback.py
src/callbacks/offline_callbacks/offline_cfd_rollout_mesh_loss_callback.py
from torch_geometric.utils import scatter from kappadata.wrappers import ModeWrapper from functools import partial import einops import torch from callbacks.base.periodic_callback import PeriodicCallback from utils.formatting_util import dict_to_string class OfflineCfdRolloutMeshLossCallback(PeriodicCallback): ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/checkpoint_callbacks/recover_from_latest_checkpoint_callback.py
src/callbacks/checkpoint_callbacks/recover_from_latest_checkpoint_callback.py
from collections import defaultdict import torch from callbacks.base.periodic_callback import PeriodicCallback from distributed.config import is_rank0 from utils.select_with_path import select_with_path from initializers.resume_initializer import ResumeInitializer from callbacks.checkpoint_callbacks.checkpoint_callba...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/checkpoint_callbacks/ema_callback.py
src/callbacks/checkpoint_callbacks/ema_callback.py
from collections import defaultdict import torch from callbacks.base.periodic_callback import PeriodicCallback from distributed.config import is_rank0 from utils.select_with_path import select_with_path class EmaCallback(PeriodicCallback): def __init__(self, target_factors, model_paths=None, **kwargs): ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/checkpoint_callbacks/checkpoint_callback.py
src/callbacks/checkpoint_callbacks/checkpoint_callback.py
from callbacks.base.periodic_callback import PeriodicCallback from utils.formatting_util import short_number_str from utils.model_utils import get_trainable_param_count, get_frozen_param_count class CheckpointCallback(PeriodicCallback): def __init__( self, save_weights=True, sa...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/checkpoint_callbacks/__init__.py
src/callbacks/checkpoint_callbacks/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/checkpoint_callbacks/best_checkpoint_callback.py
src/callbacks/checkpoint_callbacks/best_checkpoint_callback.py
from callbacks.base.periodic_callback import PeriodicCallback from utils.infer_higher_is_better import higher_is_better_from_metric_key class BestCheckpointCallback(PeriodicCallback): def __init__( self, metric_key, save_frozen_weights=True, save_optim=False, ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/online_callbacks/num_supernodes_callback.py
src/callbacks/online_callbacks/num_supernodes_callback.py
from collections import defaultdict import numpy as np import torch from callbacks.base.periodic_callback import PeriodicCallback from distributed.gather import all_reduce_mean_grad class NumSupernodesCallback(PeriodicCallback): def __init__(self, **kwargs): super().__init__(**kwargs) self.is_fi...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/online_callbacks/update_output_callback.py
src/callbacks/online_callbacks/update_output_callback.py
from collections import defaultdict import numpy as np import torch from callbacks.base.periodic_callback import PeriodicCallback from distributed.gather import all_reduce_mean_grad, all_gather_nograd class UpdateOutputCallback(PeriodicCallback): def __init__( self, keys=None, ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/online_callbacks/__init__.py
src/callbacks/online_callbacks/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/base/callback_base.py
src/callbacks/base/callback_base.py
import logging from collections import defaultdict import kappaprofiler as kp import torch from distributed.gather import all_gather_nograd from providers.config_providers.base.config_provider_base import ConfigProviderBase from providers.config_providers.noop_config_provider import NoopConfigProvider from providers....
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/base/periodic_callback.py
src/callbacks/base/periodic_callback.py
import math import kappaprofiler as kp import numpy as np import torch from kappadata.samplers import InterleavedSamplerConfig from kappadata.wrappers import ModeWrapper from torch.utils.data import SequentialSampler, DistributedSampler from tqdm import tqdm from distributed.config import is_distributed, is_managed, ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/base/__init__.py
src/callbacks/base/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/base/writers/log_writer.py
src/callbacks/base/writers/log_writer.py
import logging from collections import defaultdict from contextlib import contextmanager import torch import wandb import yaml from distributed.config import is_rank0 from providers.path_provider import PathProvider from utils.update_counter import UpdateCounter class LogWriter: def __init__(self, path_provider...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/base/writers/__init__.py
src/callbacks/base/writers/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/base/writers/checkpoint_writer.py
src/callbacks/base/writers/checkpoint_writer.py
import logging import torch import yaml from torch.nn.parallel import DistributedDataParallel from distributed.config import is_rank0 from models.base.composite_model_base import CompositeModelBase from models.base.single_model_base import SingleModelBase from providers.path_provider import PathProvider from utils.ch...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/retroactive_callbacks/__init__.py
src/callbacks/retroactive_callbacks/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/visualization/__init__.py
src/callbacks/visualization/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/monitor_callbacks/gradient_monitor_callback.py
src/callbacks/monitor_callbacks/gradient_monitor_callback.py
from callbacks.base.periodic_callback import PeriodicCallback class GradientMonitorCallback(PeriodicCallback): def before_every_optim_step(self, model, **kwargs): for name, param in model.named_parameters(): if not param.requires_grad: continue grad_norm = param.gra...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/monitor_callbacks/kill_on_loss_spike_callback.py
src/callbacks/monitor_callbacks/kill_on_loss_spike_callback.py
from collections import defaultdict import torch from callbacks.base.periodic_callback import PeriodicCallback from distributed.config import is_rank0, get_rank from utils.select_with_path import select_with_path from initializers.resume_initializer import ResumeInitializer from callbacks.checkpoint_callbacks.checkpo...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/monitor_callbacks/activation_monitor_callback.py
src/callbacks/monitor_callbacks/activation_monitor_callback.py
from callbacks.base.periodic_callback import PeriodicCallback from utils.factory import create_collection from models.extractors import extractor_from_kwargs from models.extractors.generic_extractor import GenericExtractor class ActivationMonitorCallback(PeriodicCallback): def __init__(self, model_paths, **kwargs)...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/monitor_callbacks/weight_monitor_callback.py
src/callbacks/monitor_callbacks/weight_monitor_callback.py
from callbacks.base.periodic_callback import PeriodicCallback class WeightMonitorCallback(PeriodicCallback): def _track_after_update_step(self, model, **kwargs): for name, param in model.named_parameters(): if not param.requires_grad: continue param_norm = param.nor...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/monitor_callbacks/gradient_spike_monitor_callback.py
src/callbacks/monitor_callbacks/gradient_spike_monitor_callback.py
from collections import defaultdict, deque import torch from callbacks.base.callback_base import CallbackBase class GradientSpikeMonitorCallback(CallbackBase): def __init__(self, verbose=False, **kwargs): super().__init__(**kwargs) self.verbose = verbose def _before_training(self, model, **k...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/monitor_callbacks/skip_loss_spikes_callback.py
src/callbacks/monitor_callbacks/skip_loss_spikes_callback.py
import torch from callbacks.base.periodic_callback import PeriodicCallback from collections import deque class SkipLossSpikesCallback(PeriodicCallback): def __init__(self, max_skipped_updates_in_a_row=100, queue_size=50, tolerance_factor=0.2, **kwargs): super().__init__(**kwargs) self.max_skipped_u...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/monitor_callbacks/skip_nan_loss_callback.py
src/callbacks/monitor_callbacks/skip_nan_loss_callback.py
import torch from callbacks.base.periodic_callback import PeriodicCallback from collections import deque class SkipNanLossCallback(PeriodicCallback): def __init__(self, max_skipped_updates_in_a_row=50, **kwargs): super().__init__(**kwargs) self.max_skipped_updates_in_a_row = max_skipped_updates_in_...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/monitor_callbacks/nan_monitor_callback.py
src/callbacks/monitor_callbacks/nan_monitor_callback.py
import torch from callbacks.base.callback_base import CallbackBase class NanMonitorCallback(CallbackBase): def __init__(self, verbose=False, **kwargs): super().__init__(**kwargs) self.verbose = verbose def _before_training(self, model, **kwargs): for name, module in model.named_modul...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/monitor_callbacks/__init__.py
src/callbacks/monitor_callbacks/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/monitor_callbacks/debug_monitor_callback.py
src/callbacks/monitor_callbacks/debug_monitor_callback.py
from callbacks.base.periodic_callback import PeriodicCallback class DebugMonitorCallback(PeriodicCallback): def __init__(self, verbose=False, **kwargs): super().__init__(**kwargs) self.verbose = verbose def before_every_update(self, model, **kwargs): for name, param in model.named_par...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/default_callbacks/copy_previous_config_callback.py
src/callbacks/default_callbacks/copy_previous_config_callback.py
from callbacks.base.callback_base import CallbackBase from initializers.previous_run_initializer import PreviousRunInitializer from models.base.composite_model_base import CompositeModelBase from utils.model_utils import get_named_models class CopyPreviousConfigCallback(CallbackBase): @staticmethod def _shoul...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/default_callbacks/copy_previous_summary_callback.py
src/callbacks/default_callbacks/copy_previous_summary_callback.py
from callbacks.base.callback_base import CallbackBase from initializers.previous_run_initializer import PreviousRunInitializer from models.base.composite_model_base import CompositeModelBase from utils.model_utils import get_named_models class CopyPreviousSummaryCallback(CallbackBase): @staticmethod def _shou...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/default_callbacks/eta_callback.py
src/callbacks/default_callbacks/eta_callback.py
import logging from datetime import datetime, timedelta import numpy as np from callbacks.base.periodic_callback import PeriodicCallback from distributed.config import is_rank0 from utils.formatting_util import short_number_str, seconds_to_duration_str class EtaCallback(PeriodicCallback): class LoggerWasCalledH...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/default_callbacks/online_loss_callback.py
src/callbacks/default_callbacks/online_loss_callback.py
from collections import defaultdict import numpy as np from callbacks.base.periodic_callback import PeriodicCallback from distributed.gather import all_reduce_mean_grad class OnlineLossCallback(PeriodicCallback): def __init__(self, verbose=False, **kwargs): super().__init__(**kwargs) self.verbos...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/default_callbacks/dataset_stats_callback.py
src/callbacks/default_callbacks/dataset_stats_callback.py
import torch from kappadata.utils.class_counts import get_class_counts from kappadata.wrappers import ModeWrapper, LabelSmoothingWrapper from callbacks.base.callback_base import CallbackBase class DatasetStatsCallback(CallbackBase): def _before_training(self, **_): for dataset_key, dataset in self.data_c...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/default_callbacks/train_time_callback.py
src/callbacks/default_callbacks/train_time_callback.py
import numpy as np from callbacks.base.periodic_callback import PeriodicCallback from distributed.gather import all_gather_nograd from utils.formatting_util import list_to_string class TrainTimeCallback(PeriodicCallback): def __init__(self, **kwargs): super().__init__(**kwargs) self.train_data_ti...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/default_callbacks/copy_previous_entries_callback.py
src/callbacks/default_callbacks/copy_previous_entries_callback.py
import yaml from callbacks.base.callback_base import CallbackBase from initializers.previous_run_initializer import PreviousRunInitializer from models.base.composite_model_base import CompositeModelBase from utils.checkpoint import Checkpoint from utils.model_utils import get_named_models class CopyPreviousEntriesCa...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/default_callbacks/lr_callback.py
src/callbacks/default_callbacks/lr_callback.py
from callbacks.base.periodic_callback import PeriodicCallback from models.base.composite_model_base import CompositeModelBase from optimizers.interleaved_optimizer import InterleavedOptimizer from utils.model_utils import get_named_models class LrCallback(PeriodicCallback): def should_log_after_update(self, check...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/default_callbacks/progress_callback.py
src/callbacks/default_callbacks/progress_callback.py
from datetime import datetime from callbacks.base.periodic_callback import PeriodicCallback from utils.formatting_util import seconds_to_duration_str class ProgressCallback(PeriodicCallback): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._start_time = None se...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/default_callbacks/__init__.py
src/callbacks/default_callbacks/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/default_callbacks/freezer_callback.py
src/callbacks/default_callbacks/freezer_callback.py
from callbacks.base.periodic_callback import PeriodicCallback from models.base.composite_model_base import CompositeModelBase from utils.model_utils import get_named_models class FreezerCallback(PeriodicCallback): def should_log_after_update(self, checkpoint): if checkpoint.update == 1: return...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/callbacks/default_callbacks/param_count_callback.py
src/callbacks/default_callbacks/param_count_callback.py
import numpy as np from callbacks.base.callback_base import CallbackBase from models.base.composite_model_base import CompositeModelBase from utils.model_utils import get_trainable_param_count, get_frozen_param_count from utils.naming_util import join_names, snake_type_name class ParamCountCallback(CallbackBase): ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/providers/dataset_config_provider.py
src/providers/dataset_config_provider.py
import platform from pathlib import Path class DatasetConfigProvider: def __init__( self, global_dataset_paths, local_dataset_path=None, data_source_modes=None, ): self.global_dataset_paths = global_dataset_paths self.local_dataset_path = local_d...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/providers/__init__.py
src/providers/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/providers/path_provider.py
src/providers/path_provider.py
from pathlib import Path class PathProvider: def __init__( self, output_path: Path, model_path: Path, stage_name: str, stage_id: str, temp_path: Path = None, ): self.output_path = output_path self.model_path = model_path ...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/providers/config_providers/wandb_config_provider.py
src/providers/config_providers/wandb_config_provider.py
import wandb from .base.config_provider_base import ConfigProviderBase from .primitive_config_provider import PrimitiveConfigProvider from ..path_provider import PathProvider class WandbConfigProvider(ConfigProviderBase): def __init__(self, path_provider: PathProvider): super().__init__() self.pr...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/providers/config_providers/primitive_config_provider.py
src/providers/config_providers/primitive_config_provider.py
import yaml from .base.config_provider_base import ConfigProviderBase from ..path_provider import PathProvider class PrimitiveConfigProvider(ConfigProviderBase): def __init__(self, path_provider: PathProvider): super().__init__() self.path_provider = path_provider self.config = {} de...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/providers/config_providers/__init__.py
src/providers/config_providers/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/providers/config_providers/noop_config_provider.py
src/providers/config_providers/noop_config_provider.py
from .base.config_provider_base import ConfigProviderBase class NoopConfigProvider(ConfigProviderBase): def update(self, *args, **kwargs): pass def __setitem__(self, key, value): pass def __contains__(self, key): return False def get_config_of_previous_stage(self, stage_name...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/providers/config_providers/base/config_provider_base.py
src/providers/config_providers/base/config_provider_base.py
class ConfigProviderBase: def update(self, *args, **kwargs): raise NotImplementedError def __setitem__(self, key, value): raise NotImplementedError def __contains__(self, key): raise NotImplementedError def get_config_of_previous_stage(self, stage_name, stage_id): rais...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/providers/config_providers/base/__init__.py
src/providers/config_providers/base/__init__.py
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false
ml-jku/UPT
https://github.com/ml-jku/UPT/blob/f148ef187973ef4958e8a5324c6692dd2582ad97/src/providers/summary_providers/wandb_summary_provider.py
src/providers/summary_providers/wandb_summary_provider.py
import wandb from .base.summary_provider_base import SummaryProviderBase from .primitive_summary_provider import PrimitiveSummaryProvider from ..path_provider import PathProvider class WandbSummaryProvider(SummaryProviderBase): def __init__(self, path_provider: PathProvider): super().__init__() s...
python
MIT
f148ef187973ef4958e8a5324c6692dd2582ad97
2026-01-05T07:12:15.158856Z
false