python_code
stringlengths
0
4.04M
repo_name
stringlengths
8
58
file_path
stringlengths
5
147
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from typing import Any, Callable, Dict, Optional import torch from torchvision.datasets.ucf101 import UCF1...
ClassyVision-main
classy_vision/dataset/classy_ucf101.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import Any, Iterable, Iterator from .dataloader_wrapper import DataloaderWrapper class ...
ClassyVision-main
classy_vision/dataset/dataloader_limit_wrapper.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Callable, Dict, Optional, Sequence, Union from classy_vision.dataset.transforms import Class...
ClassyVision-main
classy_vision/dataset/classy_dataset.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Iterable, Iterator from .dataloader_wrapper import DataloaderWrapper class DataloaderSkipN...
ClassyVision-main
classy_vision/dataset/dataloader_skip_none_wrapper.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import os from typing import Any, Callable, Dict, Optional import torch from classy_vision.generic.di...
ClassyVision-main
classy_vision/dataset/classy_video_dataset.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Iterable, Iterator import torch from classy_vision.generic.util import recursive_copy_to_gpu...
ClassyVision-main
classy_vision/dataset/dataloader_async_gpu_wrapper.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from enum import Enum import numpy as np from PIL import Image from ...generic.util import numpy_seed class Sampl...
ClassyVision-main
classy_vision/dataset/core/random_image_datasets.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from .list_dataset import ListDataset from .random_image_datasets import RandomImageBinaryClassDataset, RandomImageDa...
ClassyVision-main
classy_vision/dataset/core/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from torchvision.datasets.folder import default_loader class ListDataset: """Dataset that loads data using a li...
ClassyVision-main
classy_vision/dataset/core/list_dataset.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from ...generic.util import torch_seed class RandomVideoDataset: def __init__( self, ...
ClassyVision-main
classy_vision/dataset/core/random_video_datasets.py
#!/usr/bin/env python3 # Portions Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # Copyright 2020 Ross Wightman # # Licensed under the Apache License, Version 2.0 (the "License"); # you may...
ClassyVision-main
classy_vision/dataset/transforms/mixup.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import collections from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torchvision.transfor...
ClassyVision-main
classy_vision/dataset/transforms/util.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import random from typing import Any, Callable, Dict, List, Optional, Union import torch import torchvision.transfor...
ClassyVision-main
classy_vision/dataset/transforms/util_video.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from abc import ABC, abstractmethod from typing import Any, Dict class ClassyTransform(ABC): """ Class repr...
ClassyVision-main
classy_vision/dataset/transforms/classy_transform.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import traceback from pathlib import Path from typing import Any, Callable, Dict, List import torchvisi...
ClassyVision-main
classy_vision/dataset/transforms/__init__.py
#!/usr/bin/env python3 # Portions Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # MIT License # # Copyright (c) 2018 Philip Popien # # Permission is hereby granted, free of charge, to any ...
ClassyVision-main
classy_vision/dataset/transforms/autoaugment.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import register_transform from .classy_transform import ClassyTransform _IMAGENET_EIGEN_VAL = ...
ClassyVision-main
classy_vision/dataset/transforms/lighting_transform.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict import torch.optim from classy_vision.generic.util import is_pos_float from . import C...
ClassyVision-main
classy_vision/optim/rmsprop.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from abc import ABC, abstractmethod from typing import Any, Callable, Dict, Optional from classy_vision.generic.util...
ClassyVision-main
classy_vision/optim/classy_optimizer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict import torch.optim from . import ClassyOptimizer, register_optimizer @register_optim...
ClassyVision-main
classy_vision/optim/sgd.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import traceback from pathlib import Path from classy_vision.generic.registry_utils import import_all_mo...
ClassyVision-main
classy_vision/optim/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, Tuple import torch.optim from . import ClassyOptimizer, register_optimizer @registe...
ClassyVision-main
classy_vision/optim/adamw_mt.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import Any import torch.distributed as dist from classy_vision.generic.distributed_util i...
ClassyVision-main
classy_vision/optim/zero.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, Tuple import torch.optim from . import ClassyOptimizer, register_optimizer @registe...
ClassyVision-main
classy_vision/optim/adamw.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, Tuple import torch.optim from . import ClassyOptimizer, register_optimizer @registe...
ClassyVision-main
classy_vision/optim/adam.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict import torch.optim from classy_vision.generic.util import is_pos_float from torch.optim...
ClassyVision-main
classy_vision/optim/rmsprop_tf.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import traceback from pathlib import Path from typing import Any, Dict from classy_vision.generic.registry_utils imp...
ClassyVision-main
classy_vision/optim/param_scheduler/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from enum import auto, Enum from typing import Any, Dict, Sequence, Union from fvcore.common import param_scheduler ...
ClassyVision-main
classy_vision/optim/param_scheduler/composite_scheduler.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from enum import Enum from typing import Any, Dict from classy_vision.generic.util import log_class_usage from fvcor...
ClassyVision-main
classy_vision/optim/param_scheduler/classy_vision_param_scheduler.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import inspect from typing import Any, Dict from fvcore.common import param_scheduler from . import Cla...
ClassyVision-main
classy_vision/optim/param_scheduler/fvcore_schedulers.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from collections.abc import Sequence from typing import Any, Dict, List, Optional import torch.nn as nn from classy_...
ClassyVision-main
classy_vision/heads/fully_convolutional_linear_head.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import traceback from pathlib import Path from classy_vision.generic.registry_utils import import_all_mo...
ClassyVision-main
classy_vision/heads/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, Optional import torch.nn as nn from classy_vision.generic.util import get_torch_versio...
ClassyVision-main
classy_vision/heads/fully_connected_head.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, Optional import torch.nn as nn class ClassyHead(nn.Module): """ Base class f...
ClassyVision-main
classy_vision/heads/classy_head.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Vision Transformer head implementation from https://arxiv.org/abs/2010.11929. References: https://github.com/goo...
ClassyVision-main
classy_vision/heads/vision_transformer_head.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict from classy_vision.heads import ClassyHead, register_head @register_head("identity") ...
ClassyVision-main
classy_vision/heads/identity_head.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import types from typing import Any, Dict, List, Optional, Tuple import torch import torch.nn as nn from...
ClassyVision-main
classy_vision/models/classy_model.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import torch.nn as nn def r2plus1_unit( dim_in, dim_out, temporal_stride, spatial_s...
ClassyVision-main
classy_vision/models/r2plus1_util.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import warnings import torch import torch.nn as nn from classy_vision.generic.util import get_torch_version from torch import T...
ClassyVision-main
classy_vision/models/lecun_normal_init.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import math from typing import Any, Dict import numpy as np import torch.nn as nn from classy_vision.mod...
ClassyVision-main
classy_vision/models/regnet.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from collections import OrderedDict from enum import auto, Enum from typing import Any, Dict, Optional, S...
ClassyVision-main
classy_vision/models/anynet.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Vision Transformer implementation from https://arxiv.org/abs/2010.11929. References: https://github.com/google-r...
ClassyVision-main
classy_vision/models/vision_transformer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import torch import torch.nn as nn class ClassyBlock(nn.Module): """ This is a thin wrapper for ...
ClassyVision-main
classy_vision/models/classy_block.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Optional import torch.nn as nn class SqueezeAndExcitationLayer(nn.Module): """Squeeze and ...
ClassyVision-main
classy_vision/models/squeeze_and_excitation_layer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # TODO: Some batch-normalization operations are superfluous and can be removed. # dependencies: import math from col...
ClassyVision-main
classy_vision/models/densenet.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import traceback from collections import defaultdict from pathlib import Path from classy_vision.generic...
ClassyVision-main
classy_vision/models/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """MLP model.""" from typing import Any, Dict import torch.nn as nn from . import register_model from .classy_mode...
ClassyVision-main
classy_vision/models/mlp.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import math from collections import OrderedDict from typing import Any, Dict, NamedTuple, Optional impor...
ClassyVision-main
classy_vision/models/efficientnet.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Implementation of ResNeXt (https://arxiv.org/pdf/1611.05431.pdf) """ import copy import math import re import wa...
ClassyVision-main
classy_vision/models/resnext.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import Any, Dict, Sequence import torch import torch.nn as nn from classy_vision.generic....
ClassyVision-main
classy_vision/models/resnext3d.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Implementation of ResNet (https://arxiv.org/pdf/1512.03385.pdf) as a special case of ResNeXt (https://arxiv.org/p...
ClassyVision-main
classy_vision/models/resnet.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from collections import OrderedDict import torch.nn as nn from .resnext3d_block import ResBlock class ResStageBas...
ClassyVision-main
classy_vision/models/resnext3d_stage.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Sequence import torch.nn as nn from .r2plus1_util import r2plus1_unit class ResNeXt3DStemSingl...
ClassyVision-main
classy_vision/models/resnext3d_stem.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch.nn as nn from .r2plus1_util import r2plus1_unit class BasicTransformation(nn.Module): """ Bas...
ClassyVision-main
classy_vision/models/resnext3d_block.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, Sequence import torch from classy_vision.generic.distributed_util import all_reduce_su...
ClassyVision-main
classy_vision/meters/recall_meter.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import traceback from pathlib import Path from classy_vision.generic.registry_utils import import_all_modules from ...
ClassyVision-main
classy_vision/meters/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import torch from classy_vision.meters import ClassyMeter class VideoMeter(ClassyMeter): """An ...
ClassyVision-main
classy_vision/meters/video_meter.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, Sequence from classy_vision.generic.util import is_pos_int from classy_vision.meters.a...
ClassyVision-main
classy_vision/meters/video_accuracy_meter.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, Tuple import torch from classy_vision.generic.util import log_class_usage class Clas...
ClassyVision-main
classy_vision/meters/classy_meter.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, Sequence import torch from classy_vision.generic.distributed_util import all_reduce_su...
ClassyVision-main
classy_vision/meters/precision_meter.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, Sequence import torch from classy_vision.generic.distributed_util import all_reduce_su...
ClassyVision-main
classy_vision/meters/accuracy_meter.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import itertools import logging from typing import Any, Dict, Iterable, Tuple import torch import torch.nn as nn fro...
ClassyVision-main
classy_vision/hooks/exponential_moving_average_model_hook.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, Optional from classy_vision.generic.distributed_util import is_primary from classy_vis...
ClassyVision-main
classy_vision/hooks/progress_bar_hook.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from abc import ABC, abstractmethod from typing import Any, Dict from classy_vision.generic.util import log_class_us...
ClassyVision-main
classy_vision/hooks/classy_hook.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from enum import auto, Enum class ClassyHookFunctions(Enum): """ Enumeration of all the hook functions in t...
ClassyVision-main
classy_vision/hooks/constants.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from classy_vision.hooks import register_hook from classy_vision.hooks.classy_hook import ClassyHook from fvcore.comm...
ClassyVision-main
classy_vision/hooks/output_csv_hook.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import Any, Collection, Dict, Optional # noqa from classy_vision.generic.distributed_uti...
ClassyVision-main
classy_vision/hooks/checkpoint_hook.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import traceback from pathlib import Path from typing import Any, Dict, List from classy_vision.generic....
ClassyVision-main
classy_vision/hooks/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import time from itertools import accumulate from typing import Any, Dict, List, Optional, Tuple impo...
ClassyVision-main
classy_vision/hooks/tensorboard_plot_hook.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import torch from classy_vision.generic.distributed_util import is_primary from classy_vision.generic...
ClassyVision-main
classy_vision/hooks/torchscript_hook.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import Any, Dict from classy_vision.generic.profiler import profile, summarize_profiler_i...
ClassyVision-main
classy_vision/hooks/profiler_hook.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import collections.abc import logging from typing import Any, Dict from classy_vision.generic.distributed_util impor...
ClassyVision-main
classy_vision/hooks/visdom_hook.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import Any, Dict from classy_vision.generic.distributed_util import is_primary from class...
ClassyVision-main
classy_vision/hooks/model_tensorboard_hook.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import math import torch from classy_vision.generic.util import ( get_batchsize_per_replica, ...
ClassyVision-main
classy_vision/hooks/precise_batch_norm_hook.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import Optional from classy_vision.generic.distributed_util import get_rank from classy_v...
ClassyVision-main
classy_vision/hooks/loss_lr_meter_logging_hook.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from classy_vision.generic.profiler import ( ClassyProfilerNotImplementedError, compute_activ...
ClassyVision-main
classy_vision/hooks/model_complexity_hook.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from pathlib import Path from classy_vision.generic.registry_utils import import_all_modules FILE_ROOT = Path(__fi...
ClassyVision-main
classy_vision/templates/synthetic/losses/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch.nn.functional as F from classy_vision.losses import ClassyLoss, register_loss @register_loss("my_loss"...
ClassyVision-main
classy_vision/templates/synthetic/losses/my_loss.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Callable, Dict, Optional, Union from classy_vision.dataset import ClassyDataset, register_d...
ClassyVision-main
classy_vision/templates/synthetic/datasets/my_dataset.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from pathlib import Path from classy_vision.generic.registry_utils import import_all_modules FILE_ROOT = Path(__fi...
ClassyVision-main
classy_vision/templates/synthetic/datasets/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from pathlib import Path from classy_vision.generic.registry_utils import import_all_modules FILE_ROOT = Path(__fi...
ClassyVision-main
classy_vision/templates/synthetic/models/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch.nn as nn import torchvision.models as models from classy_vision.models import ClassyModel, register_mode...
ClassyVision-main
classy_vision/templates/synthetic/models/my_model.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import importlib import logging import os import sys from pathlib import Path def import_all_modules(root: str, bas...
ClassyVision-main
classy_vision/generic/registry_utils.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import collections.abc import contextlib import json import logging import os import time from functools import parti...
ClassyVision-main
classy_vision/generic/util.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
ClassyVision-main
classy_vision/generic/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from typing import Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np import torch imp...
ClassyVision-main
classy_vision/generic/visualize.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import multiprocessing import os import pdb import sys __all__ = ["set_trace"] _stdin = [None] _stdin_lock = mult...
ClassyVision-main
classy_vision/generic/pdb.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import sys def debug_info(type, value, tb): if hasattr(sys, "ps1") or not sys.stderr.isatty(): sys.__e...
ClassyVision-main
classy_vision/generic/debug.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from collections import defaultdict, deque from time import perf_counter from typing import List, Mapp...
ClassyVision-main
classy_vision/generic/perf_stats.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import os from classy_vision.generic.util import is_pos_int def add_generic_args(parser): """ ...
ClassyVision-main
classy_vision/generic/opts.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import collections.abc as abc import logging import operator from typing import Any, Callable, Dict, List, Optional, ...
ClassyVision-main
classy_vision/generic/profiler.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import io import tempfile from typing import Any, Callable, List, Tuple import torch # Default to GPU 0 _cuda_devi...
ClassyVision-main
classy_vision/generic/distributed_util.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from .classy_hub_interface import ClassyHubInterface __all__ = ["ClassyHubInterface"]
ClassyVision-main
classy_vision/hub/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Callable, Iterator, List, Optional, Union import torch import torch.nn as nn from classy_vis...
ClassyVision-main
classy_vision/hub/classy_hub_interface.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from .classy_trainer import ClassyTrainer from .distributed_trainer import DistributedTrainer from .local_trainer imp...
ClassyVision-main
classy_vision/trainer/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from classy_vision.generic.distributed_util import barrier from classy_vision.tasks import ClassyTask class Classy...
ClassyVision-main
classy_vision/trainer/classy_trainer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import os import torch from classy_vision.generic.distributed_util import ( get_rank, get_wor...
ClassyVision-main
classy_vision/trainer/distributed_trainer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import Optional from classy_vision.generic.distributed_util import set_cpu_device, set_cu...
ClassyVision-main
classy_vision/trainer/local_trainer.py
ClassyVision-main
classy_vision/hydra/__init__.py
ClassyVision-main
classy_vision/hydra/conf/__init__.py