
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
TorchRec is a PyTorch domain library built to provide common sparsity and parallelism primitives needed for large-scale recommender systems (RecSys). TorchRec allows training and inference of models with large embedding tables sharded across many GPUs and powers many production RecSys models at Meta.
TorchRec has been used to accelerate advancements in recommendation systems, some examples:
To begin learning about TorchRec, check out:
Check out the Getting Started section in the documentation for recommended ways to set up Torchrec.
Generally, there isn't a need to build from source. For most use cases, follow the section above to set up TorchRec. However, to build from source and to get the latest changes, do the following:
Install pytorch. See pytorch documentation.
CUDA 12.4
pip install torch --index-url https://download.pytorch.org/whl/nightly/cu124
CUDA 12.1
pip install torch --index-url https://download.pytorch.org/whl/nightly/cu121
CUDA 11.8
pip install torch --index-url https://download.pytorch.org/whl/nightly/cu118
CPU
pip install torch --index-url https://download.pytorch.org/whl/nightly/cpu
Clone TorchRec.
git clone --recursive https://github.com/pytorch/torchrec
cd torchrec
Install FBGEMM.
CUDA 12.4
pip install fbgemm-gpu --index-url https://download.pytorch.org/whl/nightly/cu124
CUDA 12.1
pip install fbgemm-gpu --index-url https://download.pytorch.org/whl/nightly/cu121
CUDA 11.8
pip install fbgemm-gpu --index-url https://download.pytorch.org/whl/nightly/cu118
CPU
pip install fbgemm-gpu --index-url https://download.pytorch.org/whl/nightly/cpu
Install other requirements.
pip install -r requirements.txt
Install TorchRec.
python setup.py install develop
Test the installation (use torchx-nightly for 3.11; for 3.12, torchx currently doesn't work).
GPU mode
torchx run -s local_cwd dist.ddp -j 1x2 --gpu 2 --script test_installation.py
CPU Mode
torchx run -s local_cwd dist.ddp -j 1x2 --script test_installation.py -- --cpu_only
See TorchX for more information on launching distributed and remote jobs.
If you want to run a more complex example, please take a look at the torchrec DLRM example.
See CONTRIBUTING.md for details about contributing to TorchRec!
If you're using TorchRec, please refer to BibTeX entry to cite this work:
@inproceedings{10.1145/3523227.3547387,
author = {Ivchenko, Dmytro and Van Der Staay, Dennis and Taylor, Colin and Liu, Xing and Feng, Will and Kindi, Rahul and Sudarshan, Anirudh and Sefati, Shahin},
title = {TorchRec: a PyTorch Domain Library for Recommendation Systems},
year = {2022},
isbn = {9781450392785},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3523227.3547387},
doi = {10.1145/3523227.3547387},
abstract = {Recommendation Systems (RecSys) comprise a large footprint of production-deployed AI today. The neural network-based recommender systems differ from deep learning models in other domains in using high-cardinality categorical sparse features that require large embedding tables to be trained. In this talk we introduce TorchRec, a PyTorch domain library for Recommendation Systems. This new library provides common sparsity and parallelism primitives, enabling researchers to build state-of-the-art personalization models and deploy them in production. In this talk we cover the building blocks of the TorchRec library including modeling primitives such as embedding bags and jagged tensors, optimized recommender system kernels powered by FBGEMM, a flexible sharder that supports a veriety of strategies for partitioning embedding tables, a planner that automatically generates optimized and performant sharding plans, support for GPU inference and common modeling modules for building recommender system models. TorchRec library is currently used to train large-scale recommender models at Meta. We will present how TorchRec helped Meta’s recommender system platform to transition from CPU asynchronous training to accelerator-based full-sync training.},
booktitle = {Proceedings of the 16th ACM Conference on Recommender Systems},
pages = {482–483},
numpages = {2},
keywords = {information retrieval, recommender systems},
location = {Seattle, WA, USA},
series = {RecSys '22}
}
TorchRec is BSD licensed, as found in the LICENSE file.
FAQs
TorchRec: Pytorch library for recommendation systems
We found that torchrec demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.