code
stringlengths
3.13k
58.3k
apis
list
extract_api
stringlengths
499
39.4k
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python3 import abc import math from collections import defaultdict, dequ...
[ "torchrec.metrics.metrics_namespace.compose_metric_key" ]
[((943, 965), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (952, 965), False, 'from dataclasses import dataclass\n'), ((1096, 1120), 'typing.TypeVar', 'TypeVar', (['"""DefaultValueT"""'], {}), "('DefaultValueT')\n", (1103, 1120), False, 'from typing import Any, Callable, cast, De...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import copy import itertools import logging from typing import List, Optional, Tuple, It...
[ "torchrec.distributed.utils.append_prefix", "torchrec.sparse.jagged_tensor.KeyedTensor" ]
[((1068, 1095), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1085, 1095), False, 'import logging\n'), ((3324, 3415), 'torchrec.sparse.jagged_tensor.KeyedTensor', 'KeyedTensor', ([], {'keys': 'self._emb_names', 'values': 'values', 'length_per_key': 'self._lengths_per_emb'}), '(keys=self...
from typing import ( Iterator, Any, Callable, Dict, Iterable, List, Optional, ) import io import torch import torch.utils.data.datapipes as dp from torchdata.datapipes.iter import S3FileLister, S3FileLoader from torchdata.datapipes.utils import StreamWrapper from torchrec.datasets.utils imp...
[ "torchrec.datasets.utils.ReadLinesFromCSV" ]
[((520, 545), 'torchdata.datapipes.iter.S3FileLister', 'S3FileLister', (['s3_prefixes'], {}), '(s3_prefixes)\n', (532, 545), False, 'from torchdata.datapipes.iter import S3FileLister, S3FileLoader\n'), ((560, 584), 'torchdata.datapipes.iter.S3FileLoader', 'S3FileLoader', (['dp_s3_urls'], {}), '(dp_s3_urls)\n', (572, 58...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import copy from typing import List, Tuple, Optional, Dict, cast from torchrec.distribu...
[ "torchrec.distributed.planner.types.PlannerError", "torchrec.distributed.planner.types.Storage" ]
[((2463, 2484), 'torchrec.distributed.planner.types.Storage', 'Storage', ([], {'hbm': '(0)', 'ddr': '(0)'}), '(hbm=0, ddr=0)\n', (2470, 2484), False, 'from torchrec.distributed.planner.types import Partitioner, Topology, ShardingOption, Storage, PartitionByType, PlannerError, DeviceHardware\n'), ((2964, 3033), 'typing....
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest from typing import List, cast import torch from torchrec.distributed.em...
[ "torchrec.modules.embedding_configs.EmbeddingBagConfig", "torchrec.distributed.planner.proposers.GreedyProposer", "torchrec.distributed.planner.types.Topology", "torchrec.distributed.planner.proposers.UniformProposer", "torchrec.distributed.planner.enumerators.EmbeddingEnumerator", "torchrec.distributed.e...
[((824, 869), 'torchrec.distributed.planner.types.Topology', 'Topology', ([], {'world_size': '(2)', 'compute_device': '"""cuda"""'}), "(world_size=2, compute_device='cuda')\n", (832, 869), False, 'from torchrec.distributed.planner.types import Topology, ShardingOption\n'), ((896, 934), 'torchrec.distributed.planner.enu...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import copy from functools import reduce from typing import Tuple, Dict, Optional, List,...
[ "torchrec.distributed.collective_utils.invoke_on_rank_and_broadcast_result", "torchrec.distributed.planner.storage_reservations.HeuristicalStorageReservation", "torchrec.distributed.planner.proposers.GreedyProposer", "torchrec.distributed.planner.stats.EmbeddingStats", "torchrec.distributed.planner.types.Pl...
[((3958, 3976), 'torchrec.distributed.types.ShardingPlan', 'ShardingPlan', (['plan'], {}), '(plan)\n', (3970, 3976), False, 'from torchrec.distributed.types import ShardingPlan, ShardingPlanner, ModuleSharder, ShardingType, ParameterSharding\n'), ((6132, 6203), 'torchrec.distributed.collective_utils.invoke_on_rank_and_...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import os import time from typing import Any, Callable, Dict, Iterable, Iterator, List, ...
[ "torchrec.datasets.utils.LoadFiles", "torchrec.datasets.utils.safe_cast", "torchrec.datasets.utils.ReadLinesFromCSV" ]
[((1358, 1380), 'torchrec.datasets.utils.safe_cast', 'safe_cast', (['val', 'int', '(0)'], {}), '(val, int, 0)\n', (1367, 1380), False, 'from torchrec.datasets.utils import Batch, LoadFiles, PATH_MANAGER_KEY, ReadLinesFromCSV, safe_cast\n'), ((3250, 3284), 'torch.utils.data.get_worker_info', 'torch.utils.data.get_worker...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from enum import Enum from typing import cast, Dict, List, Optional, Tuple, Union impor...
[ "torchrec.distributed.types.ShardingEnv.from_process_group", "torchrec.distributed.test_utils.test_model.TestETSharder", "torchrec.distributed.test_utils.test_model.TestEBCSharder", "torchrec.distributed.planner.Topology", "torchrec.distributed.test_utils.test_model.ModelInput.generate", "torchrec.distrib...
[((2533, 2700), 'torchrec.distributed.test_utils.test_model.ModelInput.generate', 'ModelInput.generate', ([], {'batch_size': 'batch_size', 'world_size': 'world_size', 'num_float_features': 'num_float_features', 'tables': 'tables', 'weighted_tables': '(weighted_tables or [])'}), '(batch_size=batch_size, world_size=world...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from torch.testing import FileCheck # @manual from torchr...
[ "torchrec.models.dlrm.SparseArch", "torchrec.modules.embedding_configs.EmbeddingBagConfig", "torchrec.models.dlrm.DenseArch", "torchrec.models.dlrm.choose", "torchrec.models.dlrm.InteractionArch", "torchrec.models.dlrm.DLRM", "torchrec.modules.embedding_modules.EmbeddingBagCollection", "torchrec.fx.sy...
[((715, 735), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (732, 735), False, 'import torch\n'), ((772, 869), 'torchrec.modules.embedding_configs.EmbeddingBagConfig', 'EmbeddingBagConfig', ([], {'name': '"""t1"""', 'embedding_dim': 'D', 'num_embeddings': '(10)', 'feature_names': "['f1', 'f3']"}), "...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import abc import copy import itertools import logging from collections import defaultdi...
[ "torchrec.distributed.types.TensorProperties", "torchrec.distributed.types.Shard", "torchrec.distributed.types.ShardedTensor._init_from_local_shards_and_global_metadata", "torchrec.sparse.jagged_tensor.KeyedTensor", "torchrec.distributed.utils.append_prefix", "torchrec.distributed.types.ShardMetadata" ]
[((1702, 1729), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1719, 1729), False, 'import logging\n'), ((12915, 12932), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (12926, 12932), False, 'from collections import defaultdict, OrderedDict\n'), ((6487, 6586), 'ite...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import List, Optional, Tuple, cast import torch import torch.distributed as d...
[ "torchrec.distributed.embedding_types.EmbeddingComputeKernel" ]
[((1944, 2007), 'torch.Size', 'torch.Size', (['[config[0].num_embeddings, config[0].embedding_dim]'], {}), '([config[0].num_embeddings, config[0].embedding_dim])\n', (1954, 2007), False, 'import torch\n'), ((2905, 2953), 'torchrec.distributed.embedding_types.EmbeddingComputeKernel', 'EmbeddingComputeKernel', (['config[...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest from typing import List, Optional, Tuple import torch import torch.fx fro...
[ "torchrec.sparse.jagged_tensor.JaggedTensor", "torchrec.sparse.jagged_tensor.KeyedJaggedTensor", "torchrec.fx.symbolic_trace" ]
[((545, 565), 'torch.fx.wrap', 'torch.fx.wrap', (['"""len"""'], {}), "('len')\n", (558, 565), False, 'import torch\n'), ((2737, 2754), 'torchrec.fx.symbolic_trace', 'symbolic_trace', (['m'], {}), '(m)\n', (2751, 2754), False, 'from torchrec.fx import symbolic_trace\n'), ((2858, 2896), 'torch.tensor', 'torch.tensor', ([...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import itertools import multiprocessing import os import unittest from typing import Cal...
[ "torchrec.distributed.comm_ops.alltoallv", "torchrec.test_utils.get_free_port" ]
[((1159, 1195), 'multiprocessing.get_context', 'multiprocessing.get_context', (['"""spawn"""'], {}), "('spawn')\n", (1186, 1195), False, 'import multiprocessing\n'), ((1733, 1807), 'torch.distributed.init_process_group', 'dist.init_process_group', ([], {'rank': 'rank', 'world_size': 'world_size', 'backend': 'backend'})...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import abc from typing import TypeVar, Generic, List, Tuple, Optional, Dict, Any import...
[ "torchrec.distributed.embedding_types.GroupedEmbeddingConfig", "torchrec.distributed.dist_data.KJTAllToAll", "torchrec.distributed.dist_data.KJTOneToAll", "torchrec.distributed.embedding_types.SparseFeatures" ]
[((21641, 21676), 'typing.TypeVar', 'TypeVar', (['"""F"""'], {'bound': 'Multistreamable'}), "('F', bound=Multistreamable)\n", (21648, 21676), False, 'from typing import TypeVar, Generic, List, Tuple, Optional, Dict, Any\n'), ((21681, 21693), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (21688, 21693), Fal...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import Iterator, List, Optional import torch from pyre_extensions import none...
[ "torchrec.datasets.utils.Batch" ]
[((3408, 3478), 'torch.randn', 'torch.randn', (['self.batch_size', 'self.num_dense'], {'generator': 'self.generator'}), '(self.batch_size, self.num_dense, generator=self.generator)\n', (3419, 3478), False, 'import torch\n'), ((3569, 3648), 'torch.randint', 'torch.randint', ([], {'low': '(0)', 'high': '(2)', 'size': '(s...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import contextlib import os import random import tempfile from typing import Optional, Lis...
[ "torchrec.datasets.criteo.InMemoryBinaryCriteoIterDataPipe", "torchrec.datasets.criteo.criteo_terabyte", "torchrec.datasets.criteo.BinaryCriteoUtils.get_shape_from_npy", "torchrec.datasets.criteo.BinaryCriteoUtils.load_npy_range", "torchrec.datasets.criteo.BinaryCriteoUtils.tsv_to_npys", "torchrec.dataset...
[((9349, 9363), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (9360, 9363), False, 'import random\n'), ((879, 915), 'torchrec.datasets.criteo.criteo_terabyte', 'criteo_terabyte', (['(dataset_pathname,)'], {}), '((dataset_pathname,))\n', (894, 915), False, 'from torchrec.datasets.criteo import criteo_kaggle, cri...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest from typing import Callable, List, Union import hypothesis.strategies a...
[ "torchrec.modules.mlp.MLP", "torchrec.modules.mlp.Perceptron", "torchrec.fx.symbolic_trace" ]
[((884, 907), 'hypothesis.settings', 'settings', ([], {'deadline': 'None'}), '(deadline=None)\n', (892, 907), False, 'from hypothesis import given, settings\n'), ((2929, 2966), 'torchrec.modules.mlp.Perceptron', 'Perceptron', (['in_features', 'out_features'], {}), '(in_features, out_features)\n', (2939, 2966), False, '...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import Callable, List, Optional, Any, Dict, Tuple, TypeVar import torch imp...
[ "torchrec.distributed.embedding_types.EmbeddingComputeKernel", "torchrec.distributed.embedding_sharding.SparseFeaturesAllToAll", "torchrec.distributed.embedding_lookup.GroupedPooledEmbeddingsLookup", "torchrec.distributed.embedding_sharding.SparseFeaturesOneToAll", "torchrec.distributed.embedding_sharding.g...
[((1300, 1335), 'typing.TypeVar', 'TypeVar', (['"""F"""'], {'bound': 'Multistreamable'}), "('F', bound=Multistreamable)\n", (1307, 1335), False, 'from typing import Callable, List, Optional, Any, Dict, Tuple, TypeVar\n'), ((1340, 1352), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (1347, 1352), False, 'fr...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest from typing import cast, List, Optional from unittest.mock import MagicM...
[ "torchrec.distributed.planner.proposers.GridSearchProposer", "torchrec.modules.embedding_configs.EmbeddingBagConfig", "torchrec.distributed.planner.proposers.GreedyProposer", "torchrec.distributed.planner.proposers.proposers_to_proposals_list", "torchrec.distributed.planner.types.Topology", "torchrec.dist...
[((1404, 1449), 'torchrec.distributed.planner.types.Topology', 'Topology', ([], {'world_size': '(2)', 'compute_device': '"""cuda"""'}), "(world_size=2, compute_device='cuda')\n", (1412, 1449), False, 'from torchrec.distributed.planner.types import Proposer, ShardingOption, Topology\n'), ((1476, 1514), 'torchrec.distrib...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import copy import logging from typing import Any, Dict, Iterator, List, Optional, Tuple...
[ "torchrec.distributed.utils.append_prefix", "torchrec.modules.embedding_configs.data_type_to_sparse_type", "torchrec.distributed.embedding_types.compute_kernel_to_embedding_location" ]
[((1191, 1218), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1208, 1218), False, 'import logging\n'), ((1501, 1524), 'copy.deepcopy', 'copy.deepcopy', (['original'], {}), '(original)\n', (1514, 1524), False, 'import copy\n'), ((1686, 1757), 'fbgemm_gpu.split_table_batched_embeddings_op...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import os import click import dataloader as torcharrow_dataloader import torch import t...
[ "torchrec.modules.embedding_configs.EmbeddingBagConfig", "torchrec.distributed.embeddingbag.EmbeddingBagCollectionSharder" ]
[((910, 925), 'click.command', 'click.command', ([], {}), '()\n', (923, 925), False, 'import click\n'), ((927, 968), 'click.option', 'click.option', (['"""--batch_size"""'], {'default': '(256)'}), "('--batch_size', default=256)\n", (939, 968), False, 'import click\n'), ((970, 1016), 'click.option', 'click.option', (['"...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import abc import os import random import tempfile import uuid from typing import Callab...
[ "torchrec.metrics.model_utils.parse_task_model_outputs", "torchrec.metrics.rec_metric.RecTaskInfo" ]
[((1459, 1501), 'torch.rand', 'torch.rand', (['batch_size'], {'dtype': 'torch.double'}), '(batch_size, dtype=torch.double)\n', (1469, 1501), False, 'import torch\n'), ((1592, 1634), 'torch.rand', 'torch.rand', (['batch_size'], {'dtype': 'torch.double'}), '(batch_size, dtype=torch.double)\n', (1602, 1634), False, 'impor...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python3 # from pathlib import Path import argparse import os import sys...
[ "torchrec.distributed.embedding.EmbeddingCollectionSharder", "torchrec.sparse.jagged_tensor.KeyedJaggedTensor.from_lengths_sync", "torchrec.optim.keyed.CombinedOptimizer" ]
[((2203, 2266), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""torchrec + lightning app"""'}), "(description='torchrec + lightning app')\n", (2226, 2266), False, 'import argparse\n'), ((6087, 6114), 'torch.cat', 'torch.cat', (['seqs_list'], {'dim': '(0)'}), '(seqs_list, dim=0)\n', (6096,...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest from typing import List, Optional, Type import torch from fbgemm_gpu.s...
[ "torchrec.distributed.test_utils.test_model_parallel.create_test_sharder" ]
[((1945, 2013), 'hypothesis.settings', 'settings', ([], {'verbosity': 'Verbosity.verbose', 'max_examples': '(4)', 'deadline': 'None'}), '(verbosity=Verbosity.verbose, max_examples=4, deadline=None)\n', (1953, 2013), False, 'from hypothesis import Verbosity, settings, given, strategies as st\n'), ((1365, 1390), 'torch.c...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest from typing import List, cast from torchrec.distributed.embeddingbag impo...
[ "torchrec.distributed.planner.enumerators.EmbeddingEnumerator", "torchrec.modules.embedding_configs.EmbeddingBagConfig", "torchrec.distributed.planner.types.Topology", "torchrec.distributed.planner.proposers.GreedyProposer", "torchrec.distributed.tests.test_model.TestSparseNN", "torchrec.distributed.embed...
[((797, 842), 'torchrec.distributed.planner.types.Topology', 'Topology', ([], {'world_size': '(2)', 'compute_device': '"""cuda"""'}), "(world_size=2, compute_device='cuda')\n", (805, 842), False, 'from torchrec.distributed.planner.types import Topology, ShardingOption\n'), ((869, 907), 'torchrec.distributed.planner.enu...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import os import unittest from typing import Dict, List, Type import torch import torch...
[ "torchrec.metrics.tests.test_utils.rec_metric_value_test_launcher", "torchrec.metrics.tests.test_utils.rec_metric_value_test_helper" ]
[((823, 855), 'torch.sum', 'torch.sum', (['(predictions * weights)'], {}), '(predictions * weights)\n', (832, 855), False, 'import torch\n'), ((884, 911), 'torch.sum', 'torch.sum', (['(labels * weights)'], {}), '(labels * weights)\n', (893, 911), False, 'import torch\n'), ((1912, 1985), 'torch.distributed.init_process_...
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python3 from functools import partial from typing import ( Any, Iterable, List, Mapping, Optional...
[ "torchrec.datasets.utils.rand_split_train_val", "torchrec.datasets.utils.Batch", "torchrec.datasets.criteo.criteo_kaggle", "torchrec.datasets.criteo.criteo_terabyte" ]
[((1406, 1432), 'torch.cat', 'torch.cat', (['cat_list'], {'dim': '(1)'}), '(cat_list, dim=1)\n', (1415, 1432), False, 'import torch\n'), ((2357, 2445), 'torchrec.datasets.utils.Batch', 'Batch', ([], {'dense_features': 'dense_features', 'sparse_features': 'sparse_features', 'labels': 'labels'}), '(dense_features=dense_f...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from torchrec.fx import Tracer from torchrec.modules.deepfm ...
[ "torchrec.fx.Tracer", "torchrec.modules.deepfm.DeepFM", "torchrec.modules.deepfm.FactorizationMachine" ]
[((5139, 5154), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5152, 5154), False, 'import unittest\n'), ((1157, 1190), 'torchrec.modules.deepfm.DeepFM', 'DeepFM', ([], {'dense_module': 'dense_module'}), '(dense_module=dense_module)\n', (1163, 1190), False, 'from torchrec.modules.deepfm import DeepFM, Factorizati...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import copy from collections import OrderedDict from dataclasses import dataclass from ...
[ "torchrec.distributed.sharding.dp_sequence_sharding.DpSequenceEmbeddingSharding", "torchrec.sparse.jagged_tensor.JaggedTensor", "torchrec.distributed.utils.append_prefix", "torchrec.distributed.sharding.tw_sequence_sharding.TwSequenceEmbeddingSharding", "torchrec.distributed.embedding_sharding.SparseFeature...
[((1958, 2027), 'torch.ops.load_library', 'torch.ops.load_library', (['"""//deeplearning/fbgemm/fbgemm_gpu:sparse_ops"""'], {}), "('//deeplearning/fbgemm/fbgemm_gpu:sparse_ops')\n", (1980, 2027), False, 'import torch\n'), ((2032, 2105), 'torch.ops.load_library', 'torch.ops.load_library', (['"""//deeplearning/fbgemm/fbg...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest from typing import List import torch from torchrec.sparse.jagged_tensor ...
[ "torchrec.sparse.jagged_tensor.KeyedJaggedTensor.from_offsets_sync", "torchrec.sparse.jagged_tensor.KeyedJaggedTensor", "torchrec.sparse.jagged_tensor.KeyedJaggedTensor.from_lengths_sync", "torchrec.sparse.jagged_tensor.KeyedTensor.from_tensor_list", "torchrec.sparse.jagged_tensor.JaggedTensor", "torchrec...
[((498, 588), 'torch.Tensor', 'torch.Tensor', (['[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0], [10.0, 11.0, 12.0]]'], {}), '([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0], [10.0, \n 11.0, 12.0]])\n', (510, 588), False, 'import torch\n'), ((1507, 1561), 'torch.Tensor', 'torch.Tensor', (['[1.0, 2.0, 3.0, 4....
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import List import torch from torch import nn from torchrec import Embeddin...
[ "torchrec.modules.deepfm.FactorizationMachine" ]
[((5018, 5040), 'torchrec.modules.deepfm.FactorizationMachine', 'FactorizationMachine', ([], {}), '()\n', (5038, 5040), False, 'from torchrec.modules.deepfm import DeepFM, FactorizationMachine\n'), ((5848, 5916), 'torch.cat', 'torch.cat', (['[dense_features, deep_interaction, fm_interaction]'], {'dim': '(1)'}), '([dens...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest from typing import cast, List import torch from torchrec.distributed.em...
[ "torchrec.distributed.planner.shard_estimators._calculate_tw_shard_io_sizes", "torchrec.distributed.planner.types.ParameterConstraints", "torchrec.distributed.test_utils.test_model.TestTowerCollectionSparseNN", "torchrec.distributed.planner.types.Storage", "torchrec.distributed.test_utils.test_model.TestSpa...
[((2002, 2027), 'torchrec.distributed.planner.types.Storage', 'Storage', ([], {'hbm': '(84488)', 'ddr': '(0)'}), '(hbm=84488, ddr=0)\n', (2009, 2027), False, 'from torchrec.distributed.planner.types import ParameterConstraints, Storage, Topology\n'), ((2037, 2062), 'torchrec.distributed.planner.types.Storage', 'Storage...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from torch.testing import FileCheck # @manual from torchr...
[ "torchrec.models.deepfm.FMInteractionArch", "torchrec.fx.symbolic_trace", "torchrec.models.deepfm.SimpleDeepFMNN", "torchrec.fx.Tracer", "torchrec.modules.embedding_modules.EmbeddingBagCollection", "torchrec.modules.embedding_configs.EmbeddingBagConfig" ]
[((5930, 5945), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5943, 5945), False, 'import unittest\n'), ((780, 800), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (797, 800), False, 'import torch\n'), ((920, 938), 'torch.rand', 'torch.rand', (['(B, D)'], {}), '((B, D))\n', (930, 938), False, ...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import logging from dataclasses import dataclass from typing import List, Dict, Optional...
[ "torchrec.inference.modules.quantize_embeddings", "torchrec.inference.model_packager.load_pickle_config", "torchrec.distributed.ShardingEnv.from_local", "torchrec.models.dlrm.DLRM", "torchrec.sparse.jagged_tensor.KeyedJaggedTensor", "torchrec.modules.embedding_configs.EmbeddingBagConfig" ]
[((937, 964), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (954, 964), False, 'import logging\n'), ((2366, 2586), 'torchrec.models.dlrm.DLRM', 'DLRM', ([], {'embedding_bag_collection': 'embedding_bag_collection', 'dense_in_features': 'dense_in_features', 'dense_arch_layer_sizes': 'dense...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import math from typing import Dict, Optional, Tuple, List import torch from torch impo...
[ "torchrec.distributed.planner.constants.kernel_bw_lookup", "torchrec.distributed.planner.types.PlannerError", "torchrec.distributed.planner.types.Storage" ]
[((5013, 5076), 'torchrec.distributed.planner.constants.kernel_bw_lookup', 'kernel_bw_lookup', (['compute_device', 'compute_kernel', 'caching_ratio'], {}), '(compute_device, compute_kernel, caching_ratio)\n', (5029, 5076), False, 'from torchrec.distributed.planner.constants import BIGINT_DTYPE, INTRA_NODE_BANDWIDTH, CR...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # pyre-ignore-all-errors[56] import unittest from unittest.mock import Mock, patch fro...
[ "torchrec.metrics.throughput.ThroughputMetric" ]
[((567, 609), 'unittest.mock.patch', 'patch', (["(THROUGHPUT_PATH + '.time.monotonic')"], {}), "(THROUGHPUT_PATH + '.time.monotonic')\n", (572, 609), False, 'from unittest.mock import Mock, patch\n'), ((971, 1013), 'unittest.mock.patch', 'patch', (["(THROUGHPUT_PATH + '.time.monotonic')"], {}), "(THROUGHPUT_PATH + '.ti...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from collections import OrderedDict from typing import Any, Dict, List, Optional, Tuple...
[ "torchrec.distributed.sharding.sequence_sharding.SequenceShardingContext", "torchrec.distributed.embedding_types.SparseFeatures", "torchrec.distributed.sharding.tw_sequence_sharding.InferTwSequenceEmbeddingSharding", "torchrec.distributed.embedding_sharding.ListOfSparseFeaturesListAwaitable", "torchrec.dist...
[((1527, 1596), 'torch.ops.load_library', 'torch.ops.load_library', (['"""//deeplearning/fbgemm/fbgemm_gpu:sparse_ops"""'], {}), "('//deeplearning/fbgemm/fbgemm_gpu:sparse_ops')\n", (1549, 1596), False, 'import torch\n'), ((1601, 1674), 'torch.ops.load_library', 'torch.ops.load_library', (['"""//deeplearning/fbgemm/fbg...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest from typing import cast import torch from torchrec.distributed.embeddin...
[ "torchrec.distributed.test_utils.test_model.TestSparseNN", "torchrec.distributed.planner.shard_estimators.EmbeddingPerfEstimator", "torchrec.distributed.embeddingbag.EmbeddingBagCollectionSharder", "torchrec.distributed.planner.enumerators.EmbeddingEnumerator", "torchrec.modules.embedding_configs.EmbeddingB...
[((871, 916), 'torchrec.distributed.planner.types.Topology', 'Topology', ([], {'world_size': '(2)', 'compute_device': '"""cuda"""'}), "(world_size=2, compute_device='cuda')\n", (879, 916), False, 'from torchrec.distributed.planner.types import Topology\n'), ((942, 983), 'torchrec.distributed.planner.shard_estimators.Em...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import io import os import unittest from typing import Dict, Any, List import torch imp...
[ "torchrec.optim.keyed.KeyedOptimizer", "torchrec.optim.keyed.OptimizerWrapper", "torchrec.test_utils.get_free_port", "torchrec.optim.keyed.CombinedOptimizer" ]
[((977, 1082), 'torch.testing.assert_close', 'torch.testing.assert_close', (["dict1['state']['param_1']['tensor']", "dict2['state']['param_1']['tensor']"], {}), "(dict1['state']['param_1']['tensor'], dict2[\n 'state']['param_1']['tensor'])\n", (1003, 1082), False, 'import torch\n'), ((1487, 1540), 'torch.distributed...
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python3 import copy import os import tempfile import unittest import uuid from typing import List import pytorch_lig...
[ "torchrec.modules.embedding_configs.EmbeddingBagConfig" ]
[((1494, 1616), 'torchrec.modules.embedding_configs.EmbeddingBagConfig', 'EmbeddingBagConfig', ([], {'name': '"""t1"""', 'embedding_dim': 'embedding_dim', 'num_embeddings': 'num_embeddings', 'feature_names': "['f1', 'f3']"}), "(name='t1', embedding_dim=embedding_dim, num_embeddings=\n num_embeddings, feature_names=[...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import os import unittest from functools import partial, update_wrapper from typing impo...
[ "torchrec.metrics.ne.compute_cross_entropy", "torchrec.metrics.tests.test_utils.rec_metric_value_test_helper", "torchrec.metrics.ne.compute_ne", "torchrec.metrics.tests.test_utils.rec_metric_value_test_launcher" ]
[((3681, 3729), 'functools.partial', 'partial', (['_test_ne.__func__'], {'batch_window_size': '(10)'}), '(_test_ne.__func__, batch_window_size=10)\n', (3688, 3729), False, 'from functools import partial, update_wrapper\n'), ((3823, 3884), 'functools.update_wrapper', 'update_wrapper', (['_test_ne_large_window_size', '_t...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import random import unittest from typing import Any, Iterator, List, Tuple from unittes...
[ "torchrec.datasets.utils.ParallelReadConcat", "torchrec.datasets.utils.idx_split_train_val", "torchrec.datasets.utils.rand_split_train_val" ]
[((1130, 1164), 'torchrec.datasets.utils.idx_split_train_val', 'idx_split_train_val', (['datapipe', '(0.5)'], {}), '(datapipe, 0.5)\n', (1149, 1164), False, 'from torchrec.datasets.utils import idx_split_train_val, rand_split_train_val, ParallelReadConcat\n'), ((1407, 1441), 'torchrec.datasets.utils.idx_split_train_val...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import os import unittest from collections import OrderedDict from typing import List, T...
[ "torchrec.distributed.test_utils.test_model.TestSparseNN", "torchrec.test_utils.get_free_port", "torchrec.distributed.test_utils.test_model.ModelInput.generate", "torchrec.distributed.model_parallel.get_default_sharders", "torchrec.distributed.embeddingbag.EmbeddingBagCollectionSharder", "torchrec.modules...
[((2376, 2444), 'hypothesis.settings', 'settings', ([], {'verbosity': 'Verbosity.verbose', 'max_examples': '(8)', 'deadline': 'None'}), '(verbosity=Verbosity.verbose, max_examples=8, deadline=None)\n', (2384, 2444), False, 'from hypothesis import Verbosity, given, settings\n'), ((3479, 3547), 'hypothesis.settings', 'se...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest from typing import cast, List from unittest.mock import MagicMock impor...
[ "torchrec.distributed.planner.proposers.GreedyProposer", "torchrec.distributed.embeddingbag.EmbeddingBagCollectionSharder", "torchrec.distributed.planner.enumerators.EmbeddingEnumerator", "torchrec.distributed.planner.proposers.GridSearchProposer", "torchrec.distributed.planner.proposers.UniformProposer", ...
[((960, 1005), 'torchrec.distributed.planner.types.Topology', 'Topology', ([], {'world_size': '(2)', 'compute_device': '"""cuda"""'}), "(world_size=2, compute_device='cuda')\n", (968, 1005), False, 'from torchrec.distributed.planner.types import ShardingOption, Topology\n'), ((1032, 1070), 'torchrec.distributed.planner...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest from torchrec.distributed.embeddingbag import ( EmbeddingBagCollect...
[ "torchrec.distributed.planner.shard_estimators.EmbeddingPerfEstimator", "torchrec.distributed.embeddingbag.EmbeddingBagCollectionSharder", "torchrec.distributed.planner.enumerators.EmbeddingEnumerator", "torchrec.distributed.tests.test_model.TestSparseNN", "torchrec.modules.embedding_configs.EmbeddingBagCon...
[((776, 821), 'torchrec.distributed.planner.types.Topology', 'Topology', ([], {'world_size': '(2)', 'compute_device': '"""cuda"""'}), "(world_size=2, compute_device='cuda')\n", (784, 821), False, 'from torchrec.distributed.planner.types import Topology\n'), ((847, 888), 'torchrec.distributed.planner.shard_estimators.Em...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import math from typing import cast, Dict, List, Optional, Tuple import torch from torc...
[ "torchrec.distributed.planner.types.PlannerError", "torchrec.distributed.planner.types.Storage", "torchrec.distributed.planner.utils.prod", "torchrec.distributed.planner.constants.kernel_bw_lookup" ]
[((6323, 6386), 'torchrec.distributed.planner.constants.kernel_bw_lookup', 'kernel_bw_lookup', (['compute_device', 'compute_kernel', 'caching_ratio'], {}), '(compute_device, compute_kernel, caching_ratio)\n', (6339, 6386), False, 'from torchrec.distributed.planner.constants import BATCHED_COPY_PERF_FACTOR, BIGINT_DTYPE...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import os from typing import Any, Callable, Dict, List, Optional, Union from torch.util...
[ "torchrec.datasets.utils.safe_cast", "torchrec.datasets.utils.ReadLinesFromCSV", "torchrec.datasets.utils.LoadFiles" ]
[((1402, 1437), 'os.path.join', 'os.path.join', (['root', 'MOVIES_FILENAME'], {}), '(root, MOVIES_FILENAME)\n', (1414, 1437), False, 'import os\n'), ((1460, 1495), 'torchrec.datasets.utils.LoadFiles', 'LoadFiles', (['(movies_path,)'], {'mode': '"""r"""'}), "((movies_path,), mode='r')\n", (1469, 1495), False, 'from torc...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import argparse import os from typing import List from torch import distributed as dist...
[ "torchrec.datasets.criteo.InMemoryBinaryCriteoIterDataPipe" ]
[((2147, 2192), 'os.listdir', 'os.listdir', (['args.in_memory_binary_criteo_path'], {}), '(args.in_memory_binary_criteo_path)\n', (2157, 2192), False, 'import os\n'), ((2439, 2454), 'torch.distributed.get_rank', 'dist.get_rank', ([], {}), '()\n', (2452, 2454), True, 'from torch import distributed as dist\n'), ((2476, 2...