id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
8,861 | import argparse
import sys
from typing import List, Tuple
import torch
from fbgemm_gpu.split_table_batched_embeddings_ops_training import EmbeddingLocation
from torchrec.github.benchmarks import ebc_benchmarks_utils
from torchrec.modules.embedding_configs import EmbeddingBagConfig
from torchrec.modules.embedding_module... | null |
8,862 | import argparse
import sys
from typing import List, Tuple
import torch
from fbgemm_gpu.split_table_batched_embeddings_ops_training import EmbeddingLocation
from torchrec.github.benchmarks import ebc_benchmarks_utils
from torchrec.modules.embedding_configs import EmbeddingBagConfig
from torchrec.modules.embedding_module... | null |
8,863 | from typing import Dict, Optional, Tuple, Union
import torch
import torch.nn as nn
from torchrec.modules.embedding_modules import (
EmbeddingBagCollection,
EmbeddingCollection,
)
from torchrec.modules.mc_modules import ManagedCollisionCollection
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJagge... | null |
8,864 | import abc
from typing import Dict, Optional
import torch
from torch import nn
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
# pyre-ignore
class KeyedJaggedTensor(Pipelineable, metaclass=JaggedTensorMeta):
"""Represents an (optionall... | null |
8,865 | import copy
from collections import defaultdict
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union
import torch
from torch.profiler import record_function
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
def extract_module_or_tensor_callable(
module_or_callable: Unio... | null |
8,866 | import copy
from collections import defaultdict
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union
import torch
from torch.profiler import record_function
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
def get_module_output_dimension(
module: Union[Callable[[torch.T... | Verify that the out_features of a given module or a list of modules matches the specified number. If a list of modules or a ModuleList is given, recursively check all the submodules. |
8,867 | import copy
from collections import defaultdict
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union
import torch
from torch.profiler import record_function
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
def init_mlp_weights_xavier_uniform(m: torch.nn.Module) -> None:
... | Given a single module, construct a (nested) ModuleList of size of sizes by making copies of the provided module and reinitializing the Linear layers. |
8,868 | import copy
from collections import defaultdict
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union
import torch
from torch.profiler import record_function
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
def convert_list_of_modules_to_modulelist(
modules: Iterable[to... | null |
8,869 | import copy
from collections import defaultdict
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union
import torch
from torch.profiler import record_function
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
def _permute_indices(indices: List[int], permute: List[int]) -> List... | null |
8,870 | import copy
from collections import defaultdict
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union
import torch
from torch.profiler import record_function
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
def _fx_to_list(tensor: torch.Tensor) -> List[int]:
return tenso... | null |
8,871 | from typing import List, Optional, Tuple
import torch
import torch.nn as nn
from torchrec.modules.embedding_modules import (
EmbeddingBagCollection,
EmbeddingCollection,
)
from torchrec.sparse.jagged_tensor import KeyedJaggedTensor
class EmbeddingBagCollection(EmbeddingBagCollectionInterface):
"""
Embe... | Utilty to compute the mapping of tower KJT args to pass to the embedding modules. Args: module (nn.Module): Returns: Tuple[bool, bool]: tuple of 2 booleans representing if KJT and weighted KJT are required, respectively. |
8,872 | import abc
from collections import OrderedDict
from typing import Any, Dict, Iterator, List, Optional, Tuple
import torch
import torch.nn as nn
from torchrec.fx.tracer import is_fx_tracing
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
# pyre-ignore
class JaggedTensor(Pipelineable, met... | null |
8,873 | import abc
from collections import OrderedDict
from typing import Any, Dict, Iterator, List, Optional, Tuple
import torch
import torch.nn as nn
from torchrec.fx.tracer import is_fx_tracing
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
def offsets_to_range_traceble(
offsets: torch.Tensor... | null |
8,874 | import abc
from collections import defaultdict
from typing import Callable, Dict, List, NamedTuple, Optional, Tuple, Union
import torch
from torch import nn
from torchrec.modules.embedding_configs import BaseEmbeddingConfig
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
# pyre-ignore
c... | Applies an MC method to a dictionary of JaggedTensors, returning the updated dictionary with same ordering |
8,875 | import abc
from collections import defaultdict
from typing import Callable, Dict, List, NamedTuple, Optional, Tuple, Union
import torch
from torch import nn
from torchrec.modules.embedding_configs import BaseEmbeddingConfig
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
The provided code sni... | Threshold is total_count / num_ids * threshold_skew_multiplier. An id is added if its count is strictly greater than the threshold. |
8,876 | import abc
from collections import defaultdict
from typing import Callable, Dict, List, NamedTuple, Optional, Tuple, Union
import torch
from torch import nn
from torchrec.modules.embedding_configs import BaseEmbeddingConfig
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
The provided code sni... | Threshold is average of id_counts. An id is added if its count is strictly greater than the mean. |
8,877 | import abc
from collections import defaultdict
from typing import Callable, Dict, List, NamedTuple, Optional, Tuple, Union
import torch
from torch import nn
from torchrec.modules.embedding_configs import BaseEmbeddingConfig
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
The provided code sni... | Each id has probability per_id_probability of being added. For example, if per_id_probability is 0.01 and an id appears 100 times, then it has a 60% of being added. More precisely, the id score is 1 - (1 - per_id_probability) ^ id_count, and for a randomly generated threshold, the id score is the chance of it being add... |
8,878 | from typing import List
import torch
from torch import nn
from torch.fx import wrap
def _get_flatten_input(inputs: List[torch.Tensor]) -> torch.Tensor:
return torch.cat(
[input.flatten(1) for input in inputs],
dim=1,
) | null |
8,879 | import copy
import itertools
from collections import defaultdict
from typing import Any, cast, Dict, Iterator, List, Optional, Set, Tuple, Type
import torch
import torch.nn as nn
import torchrec.optim as trec_optim
from fbgemm_gpu.split_embedding_configs import EmbOptimType
from fbgemm_gpu.split_table_batched_embedding... | null |
8,880 | import copy
import itertools
from collections import defaultdict
from typing import Any, cast, Dict, Iterator, List, Optional, Set, Tuple, Type
import torch
import torch.nn as nn
import torchrec.optim as trec_optim
from fbgemm_gpu.split_embedding_configs import EmbOptimType
from fbgemm_gpu.split_table_batched_embedding... | Recursively replaces EmbeddingBagCollection and EmbeddingCollection with FusedEmbeddingBagCollection and FusedEmbeddingCollection in a model subtree. The fused modules will be initialized using the passed in optimizer parameters, and model location. Args: model: (nn.Module): optimizer_type: (Type[torch.optim.Optimizer]... |
8,881 | from dataclasses import dataclass, field
from enum import Enum, unique
from functools import partial
from math import sqrt
from typing import Callable, Dict, List, NamedTuple, Optional
import torch
from fbgemm_gpu.split_embedding_configs import SparseType
from fbgemm_gpu.split_table_batched_embeddings_ops_training impo... | null |
8,882 | from dataclasses import dataclass, field
from enum import Enum, unique
from functools import partial
from math import sqrt
from typing import Callable, Dict, List, NamedTuple, Optional
import torch
from fbgemm_gpu.split_embedding_configs import SparseType
from fbgemm_gpu.split_table_batched_embeddings_ops_training impo... | null |
8,883 | from dataclasses import dataclass, field
from enum import Enum, unique
from functools import partial
from math import sqrt
from typing import Callable, Dict, List, NamedTuple, Optional
import torch
from fbgemm_gpu.split_embedding_configs import SparseType
from fbgemm_gpu.split_table_batched_embeddings_ops_training impo... | null |
8,884 | from typing import Dict, List, Set, Union
import torch
import torch.nn as nn
from torchrec.modules.embedding_modules import EmbeddingBagCollection
from torchrec.modules.feature_processor_ import (
FeatureProcessor,
FeatureProcessorsCollection,
)
from torchrec.sparse.jagged_tensor import KeyedJaggedTensor, Keyed... | null |
8,885 | import functools
import inspect
from typing import Any, Callable
import torch
import torch.utils.hooks as hooks
from torch.nn.modules.lazy import _LazyProtocol, LazyModuleMixin
from torch.nn.modules.module import (
_global_backward_hooks,
_global_forward_hooks,
_global_forward_pre_hooks,
)
def _apply_functi... | Attaches a function to a module, which will be applied recursively to every submodule (as returned by `.children()`) of the module as well as the module itself right after the first forward pass (i.e. after all submodules and parameters have been initialized). Typical use includes initializing the numerical value of th... |
8,886 | import abc
from typing import Dict, List, Optional, Tuple, Union
import torch
import torch.nn as nn
from torchrec.modules.embedding_configs import (
DataType,
EmbeddingBagConfig,
EmbeddingConfig,
pooling_type_to_str,
)
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor, KeyedTenso... | null |
8,887 | import abc
from typing import Dict, List, Optional, Tuple, Union
import torch
import torch.nn as nn
from torchrec.modules.embedding_configs import (
DataType,
EmbeddingBagConfig,
EmbeddingConfig,
pooling_type_to_str,
)
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor, KeyedTenso... | null |
8,888 | import abc
from typing import Dict, List, Optional, Tuple, Union
import torch
import torch.nn as nn
from torchrec.modules.embedding_configs import (
DataType,
EmbeddingBagConfig,
EmbeddingConfig,
pooling_type_to_str,
)
from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor, KeyedTenso... | null |
8,889 | import abc
import json
from dataclasses import asdict, dataclass
from typing import Any, Dict, List, Optional, Tuple, Type
import torch
import torch.nn as nn
import torch.quantization as quant
import torchrec as trec
import torchrec.quant as trec_quant
from torchrec.modules.embedding_configs import QuantConfig
from tor... | null |
8,890 | import abc
import json
from dataclasses import asdict, dataclass
from typing import Any, Dict, List, Optional, Tuple, Type
import torch
import torch.nn as nn
import torch.quantization as quant
import torchrec as trec
import torchrec.quant as trec_quant
from torchrec.modules.embedding_configs import QuantConfig
from tor... | null |
8,891 | import abc
import json
from dataclasses import asdict, dataclass
from typing import Any, Dict, List, Optional, Tuple, Type
import torch
import torch.nn as nn
import torch.quantization as quant
import torchrec as trec
import torchrec.quant as trec_quant
from torchrec.modules.embedding_configs import QuantConfig
from tor... | null |
8,892 | import abc
from pathlib import Path
from typing import Any, BinaryIO, Dict, List, Type, TypeVar, Union
import torch
from torch.package import PackageExporter
from torchrec.inference.modules import PredictFactory
try:
# pyre-fixme[21]: Could not find module `torch_package_importer`.
import torch_package_importer... | null |
8,893 | import abc
from pathlib import Path
from typing import Any, BinaryIO, Dict, List, Type, TypeVar, Union
import torch
from torch.package import PackageExporter
from torchrec.inference.modules import PredictFactory
T = TypeVar("T")
try:
# pyre-fixme[21]: Could not find module `torch_package_importer`.
import torch... | null |
8,894 | import argparse
import logging
import grpc
import torch
from gen.torchrec.inference import predictor_pb2, predictor_pb2_grpc
from torch.utils.data import DataLoader
from torchrec.datasets.criteo import DEFAULT_CAT_NAMES, DEFAULT_INT_NAMES
from torchrec.datasets.random import RandomRecDataset
from torchrec.datasets.util... | null |
8,895 | import argparse
import logging
import grpc
import torch
from gen.torchrec.inference import predictor_pb2, predictor_pb2_grpc
from torch.utils.data import DataLoader
from torchrec.datasets.criteo import DEFAULT_CAT_NAMES, DEFAULT_INT_NAMES
from torchrec.datasets.random import RandomRecDataset
from torchrec.datasets.util... | null |
8,896 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_calibratio... | null |
8,897 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
CALIBRATION_NUM = "cali... | null |
8,898 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torch import distributed as dist
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
Metri... | null |
8,899 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torch import distributed as dist
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
Metri... | null |
8,900 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torch import distributed as dist
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
Metri... | null |
8,901 | from enum import Enum
from typing import Optional
class MetricNameBase(StrValueMixin, Enum):
pass
class MetricNamespaceBase(StrValueMixin, Enum):
pass
class MetricPrefix(StrValueMixin, Enum):
DEFAULT = ""
LIFETIME = "lifetime_"
WINDOW = "window_"
The provided code snippet includes necessary depende... | r"""Get the re (regular expression) pattern to find a set of metrics regardless task names. The motivation to have this API is from the past bugs which tools hard-code the patterns but the naming change, causing some testing issues. |
8,902 | from enum import Enum
from typing import Optional
class MetricNameBase(StrValueMixin, Enum):
pass
class MetricNamespaceBase(StrValueMixin, Enum):
pass
class MetricPrefix(StrValueMixin, Enum):
DEFAULT = ""
LIFETIME = "lifetime_"
WINDOW = "window_"
def compose_metric_namespace(
namespace: MetricNa... | r"""Get the metric key based on the input parameters |
8,903 | from typing import Any, Dict, List, Optional, Type
import torch
from torch import distributed as dist
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricCompu... | null |
8,904 | from typing import Any, Dict, List, Optional, Type
import torch
from torch import distributed as dist
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricCompu... | null |
8,905 | from typing import Any, Dict, List, Optional, Type
import torch
from torch import distributed as dist
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricCompu... | null |
8,906 | from typing import Any, Dict, List, Optional, Type
import torch
from torch import distributed as dist
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricCompu... | null |
8,907 | from typing import Any, Dict, List, Optional, Type
import torch
from torch import distributed as dist
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricCompu... | null |
8,908 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_multiclass... | null |
8,909 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_true_positi... | null |
8,910 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_accuracy(
... | null |
8,911 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_accuracy_su... | null |
8,912 | import abc
import logging
import time
from typing import Any, Dict, List, Optional, Type, Union
import torch
import torch.distributed as dist
import torch.nn as nn
from torch.profiler import record_function
from torchrec.metrics.accuracy import AccuracyMetric
from torchrec.metrics.auc import AUCMetric
from torchrec.met... | null |
8,913 | from functools import partial
from typing import Any, cast, Dict, List, Optional, Type
import torch
import torch.distributed as dist
import torch.nn.functional as F
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricP... | Computes AUPRC (Area Under the Curve) for binary classification. Args: n_tasks (int): number of tasks. predictions (torch.Tensor): tensor of size (n_tasks, n_examples). labels (torch.Tensor): tensor of size (n_tasks, n_examples). weights (torch.Tensor): tensor of size (n_tasks, n_examples). |
8,914 | from functools import partial
from typing import Any, cast, Dict, List, Optional, Type
import torch
import torch.distributed as dist
import torch.nn.functional as F
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricP... | Computes AUPRC (Area Under the Curve) for binary classification for groups of predictions/labels. Args: n_tasks (int): number of tasks predictions (torch.Tensor): tensor of size (n_tasks, n_examples) labels (torch.Tensor): tensor of size (n_tasks, n_examples) weights (torch.Tensor): tensor of size (n_tasks, n_examples)... |
8,915 | from functools import partial
from typing import Any, cast, Dict, List, Optional, Type
import torch
import torch.distributed as dist
import torch.nn.functional as F
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricP... | null |
8,916 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_ctr(ctr_nu... | null |
8,917 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
CTR_NUM = "ctr_num"
CTR... | null |
8,918 | import logging
from typing import Any, cast, Dict, List, Optional, Set, Type, Union
import torch
from torch import distributed as dist
from torchrec.metrics.metrics_config import RecTaskInfo, SessionMetricDef
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.... | null |
8,919 | import logging
from typing import Any, cast, Dict, List, Optional, Set, Type, Union
import torch
from torch import distributed as dist
from torchrec.metrics.metrics_config import RecTaskInfo, SessionMetricDef
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.... | null |
8,920 | import logging
from typing import Any, cast, Dict, List, Optional, Set, Type, Union
import torch
from torch import distributed as dist
from torchrec.metrics.metrics_config import RecTaskInfo, SessionMetricDef
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.... | null |
8,921 | import logging
from typing import Any, cast, Dict, List, Optional, Set, Type, Union
import torch
from torch import distributed as dist
from torchrec.metrics.metrics_config import RecTaskInfo, SessionMetricDef
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.... | null |
8,922 | import logging
from typing import Any, cast, Dict, List, Optional, Set, Type, Union
import torch
from torch import distributed as dist
from torchrec.metrics.metrics_config import RecTaskInfo, SessionMetricDef
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.... | null |
8,923 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_mae(
e... | null |
8,924 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_error_sum(
... | null |
8,925 | from typing import Dict, List, Optional, Tuple
import torch
from torchrec.metrics.rec_metric import RecTaskInfo
def is_empty_signals(
labels: torch.Tensor,
predictions: torch.Tensor,
weights: torch.Tensor,
) -> bool:
return (
torch.numel(labels) <= 0
and torch.numel(predictions) <= 0
... | null |
8,926 | import time
from typing import Any, cast, Dict, List, Optional, Type
import torch
import torch.distributed as dist
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
... | null |
8,927 | import time
from typing import Any, cast, Dict, List, Optional, Type
import torch
import torch.distributed as dist
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
... | null |
8,928 | from functools import partial
from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Type
import torch
import torch.distributed as dist
from torchmetrics.utilities.distributed import gather_all_tensors
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_na... | Computes AUC (Area Under the Curve) for binary classification. Args: n_tasks (int): number of tasks. predictions (List[torch.Tensor]): tensor of size (n_tasks, n_examples). labels (List[torch.Tensor]): tensor of size (n_tasks, n_examples). weights (List[torch.Tensor]): tensor of size (n_tasks, n_examples). |
8,929 | from functools import partial
from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Type
import torch
import torch.distributed as dist
from torchmetrics.utilities.distributed import gather_all_tensors
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_na... | Computes AUC (Area Under the Curve) for binary classification for groups of predictions/labels. Args: n_tasks (int): number of tasks predictions (List[torch.Tensor]): tensor of size (n_tasks, n_examples) labels (List[torch.Tensor]: tensor of size (n_tasks, n_examples) weights (List[torch.Tensor]): tensor of size (n_tas... |
8,930 | from functools import partial
from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Type
import torch
import torch.distributed as dist
from torchmetrics.utilities.distributed import gather_all_tensors
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_na... | null |
8,931 | from functools import partial
from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Type
import torch
import torch.distributed as dist
from torchmetrics.utilities.distributed import gather_all_tensors
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_na... | Computes RAUC (Regression AUC) for regression tasks. Args: predictions (List[torch.Tensor]): tensor of size (n_tasks, n_examples). labels (List[torch.Tensor]): tensor of size (n_tasks, n_examples). weights (List[torch.Tensor]): tensor of size (n_tasks, n_examples). |
8,932 | from functools import partial
from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Type
import torch
import torch.distributed as dist
from torchmetrics.utilities.distributed import gather_all_tensors
from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
from torchrec.metrics.metrics_na... | Computes RAUC (Regression AUC) for regression tasks for groups of predictions/labels. Args: n_tasks (int): number of tasks predictions (List[torch.Tensor]): tensor of size (n_tasks, n_examples) labels (List[torch.Tensor]: tensor of size (n_tasks, n_examples) weights (List[torch.Tensor]): tensor of size (n_tasks, n_exam... |
8,934 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_mse(
e... | null |
8,935 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_rmse(
... | null |
8,936 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_error_sum(
... | null |
8,937 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def _compute_cross_entr... | null |
8,938 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_logloss(
... | null |
8,939 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_cross_entro... | null |
8,940 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_xauc(
... | null |
8,941 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
RecMetricException,
)
def compute_error_sum(
... | null |
8,942 | from typing import Any, cast, Dict, List, Optional, Type
import torch
from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
from torchrec.metrics.rec_metric import (
MetricComputationReport,
RecMetric,
RecMetricComputation,
)
def get_mean(value_sum: torch.Tensor, num_samp... | null |
8,943 | from typing import Optional, Union
import torch
from torch import nn
from torchrec.distributed.model_parallel import DistributedModelParallel
from torchrec.distributed.quant_embeddingbag import ShardedQuantEmbeddingBagCollection
from torchrec.quant.embedding_modules import (
EmbeddingBagCollection as QuantEmbedding... | null |
8,944 | from typing import Optional, Union
import torch
from torch import nn
from torchrec.distributed.model_parallel import DistributedModelParallel
from torchrec.distributed.quant_embeddingbag import ShardedQuantEmbeddingBagCollection
from torchrec.quant.embedding_modules import (
EmbeddingBagCollection as QuantEmbedding... | null |
8,945 | import copy
import itertools
from collections import defaultdict
from typing import Callable, cast, Dict, List, Optional, Tuple, Type, Union
import torch
import torch.nn as nn
from fbgemm_gpu.split_table_batched_embeddings_ops_inference import (
EmbeddingLocation,
IntNBitTableBatchedEmbeddingBagsCodegen,
Po... | null |
8,946 | import copy
import itertools
from collections import defaultdict
from typing import Callable, cast, Dict, List, Optional, Tuple, Type, Union
import torch
import torch.nn as nn
from fbgemm_gpu.split_table_batched_embeddings_ops_inference import (
EmbeddingLocation,
IntNBitTableBatchedEmbeddingBagsCodegen,
Po... | null |
8,947 | import copy
import itertools
from collections import defaultdict
from typing import Callable, cast, Dict, List, Optional, Tuple, Type, Union
import torch
import torch.nn as nn
from fbgemm_gpu.split_table_batched_embeddings_ops_inference import (
EmbeddingLocation,
IntNBitTableBatchedEmbeddingBagsCodegen,
Po... | null |
8,948 | import copy
import itertools
from collections import defaultdict
from typing import Callable, cast, Dict, List, Optional, Tuple, Type, Union
import torch
import torch.nn as nn
from fbgemm_gpu.split_table_batched_embeddings_ops_inference import (
EmbeddingLocation,
IntNBitTableBatchedEmbeddingBagsCodegen,
Po... | null |
8,949 | import copy
import itertools
from collections import defaultdict
from typing import Callable, cast, Dict, List, Optional, Tuple, Type, Union
import torch
import torch.nn as nn
from fbgemm_gpu.split_table_batched_embeddings_ops_inference import (
EmbeddingLocation,
IntNBitTableBatchedEmbeddingBagsCodegen,
Po... | null |
8,950 | import copy
import itertools
from collections import defaultdict
from typing import Callable, cast, Dict, List, Optional, Tuple, Type, Union
import torch
import torch.nn as nn
from fbgemm_gpu.split_table_batched_embeddings_ops_inference import (
EmbeddingLocation,
IntNBitTableBatchedEmbeddingBagsCodegen,
Po... | null |
8,951 | import copy
import itertools
from collections import defaultdict
from typing import Callable, cast, Dict, List, Optional, Tuple, Type, Union
import torch
import torch.nn as nn
from fbgemm_gpu.split_table_batched_embeddings_ops_inference import (
EmbeddingLocation,
IntNBitTableBatchedEmbeddingBagsCodegen,
Po... | null |
8,952 | import copy
import itertools
from collections import defaultdict
from typing import Callable, cast, Dict, List, Optional, Tuple, Type, Union
import torch
import torch.nn as nn
from fbgemm_gpu.split_table_batched_embeddings_ops_inference import (
EmbeddingLocation,
IntNBitTableBatchedEmbeddingBagsCodegen,
Po... | null |
8,953 | from typing import Any, Callable, Dict, List, Optional, Union
import torch
from torch.fx._compatibility import compatibility
from torch.fx.graph import Graph
from torch.fx.node import Argument
from torchrec.distributed.types import LazyAwaitable, NoWait
from torchrec.fx.utils import dmp_fx_trace_forward
_is_fx_tracing_... | null |
8,954 | from typing import Any, Callable, Dict, List, Optional, Union
import torch
from torch.fx._compatibility import compatibility
from torch.fx.graph import Graph
from torch.fx.node import Argument
from torchrec.distributed.types import LazyAwaitable, NoWait
from torchrec.fx.utils import dmp_fx_trace_forward
class Tracer(to... | Symbolic tracing API Given an ``nn.Module`` or function instance ``root``, this function will return a ``GraphModule`` constructed by recording operations seen while tracing through ``root``. ``concrete_args`` allows you to partially specialize your function, whether it's to remove control flow or data structures. Args... |
8,955 | import inspect
from typing import Any, Dict, List, Set
import torch
from torch.fx._symbolic_trace import is_fx_tracing
def fake_range():
# pyre-fixme[16]: Module `_C` has no attribute `_jit_tree_views`.
return torch._C._jit_tree_views.SourceRangeFactory("", None, 0, 0).make_raw_range(
0, 1
)
def dm... | null |
8,956 | import inspect
from typing import Any, Dict, List, Set
import torch
from torch.fx._symbolic_trace import is_fx_tracing
def _fx_marker(s: str, any_proxy_unused: Any) -> None:
pass
def fx_marker(s: str, any_proxy_unused: Any) -> None:
if is_fx_tracing():
_fx_marker(s, any_proxy_unused) | null |
8,957 | import inspect
from typing import Any, Dict, List, Set
import torch
from torch.fx._symbolic_trace import is_fx_tracing
def _fx_marker(s: str, any_proxy_unused: Any) -> None:
pass
def is_marker_node(node: torch.fx.Node, marker_name: str) -> bool:
# bool() syntax for pyre
return bool(
node.op == "cal... | null |
8,958 | import ast
import json
from argparse import ArgumentParser, Namespace
from typing import Any, Dict, List, Optional, Tuple
def check_class_definition(python_path: str, node: ast.ClassDef) -> None:
"""
This function will run set of sanity checks against class definitions
and their docstrings.
Args:
... | This function will check all Modules defined in the given file for a valid documentation based on the AST. Input args: python_path: Path to the file that need to be verified with the linter. Returns: None |
8,959 | import ast
import json
from argparse import ArgumentParser, Namespace
from typing import Any, Dict, List, Optional, Tuple
def _make_argparse() -> ArgumentParser: # pragma: nocover
parser = ArgumentParser(
description="TorchRec docstring linter", fromfile_prefix_chars="@"
)
parser.add_argument("sour... | null |
8,960 | import itertools
from typing import List, Tuple
import torch
import torch._prims_common as utils
def down_size(N: int, size: torch.Size) -> Tuple[int, int]:
assert size[-1] % N == 0, f"{size} last dim not divisible by {N}"
return (*size[:-1], size[-1] // N) | null |
8,961 | import itertools
from typing import List, Tuple
import torch
import torch._prims_common as utils
def up_size(N: int, size: torch.Size) -> Tuple[int, int]:
return (*size[:-1], size[-1] * N) | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.