transact-tf
An unofficial implementation of "TransAct: Transformer-based Realtime User Action Model for Recommendation at Pinterest" in Tensorflow
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in README -
✓Academic publication links
Links to: acm.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.3%) to scientific vocabulary
Keywords
Repository
An unofficial implementation of "TransAct: Transformer-based Realtime User Action Model for Recommendation at Pinterest" in Tensorflow
Basic Info
Statistics
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 4
Topics
Metadata Files
README.md
TransAct 
This is NOT the official implementation by the authors of this model architecture. You can find the official pytorch implementation here. This repo is a Tensorflow implementation of TransAct: Transformer-based Realtime User Action Model for Recommendation at Pinterest by Xia, Xue, et al. TransAct is the ranking architecture used by Pinterest's Homefeed to personalize and extract users' short-term preferences from their realtime activities. The paper was presented at KDD 2023.

Installation
PyPI
New user registration on PyPI is temporarily suspended due to malicious attacks. Once admins enable, will add. Until then, skip ahead to the docker step.
Run the following to install:
sh
pip install transact-tf
Docker
To install the package using Docker run the following:
sh
docker pull ghcr.io/awadalaa/transact:release
Developing transact
To install transact, along with tools you need to develop and test, run the following in your virtualenv:
```sh git clone https://github.com/awadalaa/transact.git
or clone your own fork
cd transact pip install -e . ```
To run rank and shape tests run any of the following:
py
python -m transact.test_transact
pytest transact --verbose
Usage
```python import tensorflow as tf from transact import TensorflowTransAct, TransActConfig
numactions = 5 actionvocab = list(range(0, numactions)) fullseqlen = 10 testbatchsize = 8 actionembdim = 32 itemembdim = 32 timewindowms = 1000 * 60 * 60 * 1 # 1 hr latestn_emb = 10
Generate random tensors in TensorFlow as input
actiontypeseq = tf.random.uniform(shape=(testbatchsize, fullseqlen), minval=0, maxval=numactions, dtype=tf.int32) itemembeddingseq = tf.random.uniform(shape=(testbatchsize, fullseqlen, itemembdim), dtype=tf.float32) actiontimeseq = tf.random.uniform(shape=(testbatchsize, fullseqlen), minval=0, maxval=numactions, dtype=tf.int32) requesttime = tf.random.uniform(shape=(testbatchsize,), minval=500000, maxval=1000000, dtype=tf.int32) itemembedding = tf.random.uniform(shape=(testbatchsize, itemembdim), dtype=tf.float32) inputfeatures = ( actiontypeseq, itemembeddingseq, actiontimeseq, requesttime, item_embedding, )
Initialize the transact module
transactconfig = TransActConfig( actionvocab=actionvocab, actionembdim=actionembdim, itemembdim=itemembdim, timewindowms=timewindowms, latestnemb=latestnemb, seqlen=fullseqlen, ) model = TensorflowTransAct(transact_config)
userembedding = model(*inputfeatures)
```
Run with Docker
You can also run the example script with Docker.
```sh git clone https://github.com/awadalaa/transact.git cd transact
docker run -it --rm \ --mount type=bind,source="$(pwd)"/example,target=/usr/src/transact/dockerexample \ ghcr.io/awadalaa/transact:release \ python dockerexample/docker_example.py ```
Want to Contribute 🙋♂️?
Awesome! If you want to contribute to this project, you're always welcome! See Contributing Guidelines. You can also take a look at open issues for getting more information about current or upcoming tasks.
Want to discuss? 💬
Have any questions, doubts or want to present your opinions, views? You're always welcome. You can start discussions.
Citation
bibtex
@article{xia2023transact,
title={TransAct: Transformer-based Realtime User Action Model for Recommendation at Pinterest},
author={Xia, Xue and Eksombatchai, Pong and Pancha, Nikil and Badani, Dhruvil Deven and Wang, Po-Wei and Gu, Neng and Joshi, Saurabh Vishwas and Farahpour, Nazanin and Zhang, Zhiyuan and Zhai, Andrew},
journal={arXiv preprint arXiv:2306.00248},
year={2023}
}
License
``` Copyright 2023 Alaa Awad
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ```
Owner
- Name: Alaa
- Login: awadalaa
- Kind: user
- Location: Brooklyn, NY
- Company: @etsy
- Website: awadalaa.github.io
- Repositories: 43
- Profile: https://github.com/awadalaa
Software Engineer at Etsy
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Awad" given-names: "Alaa" orcid: "https://orcid.org/0000-0000-0000-0000" title: "transact" version: 0.1.0 doi: 10.5281/zenodo.1234 date-released: 2023-11-25 url: "https://github.com/awadalaa/transact"
GitHub Events
Total
- Watch event: 2
Last Year
- Watch event: 2
Packages
- Total packages: 1
-
Total downloads:
- pypi 16 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 2
- Total maintainers: 1
pypi.org: transact-tf
An implementation of TransAct: Transformer-based Realtime User Action Model for Recommendation
- Homepage: https://github.com/awadalaa/TransAct
- Documentation: https://transact-tf.readthedocs.io/
- License: MIT License
-
Latest release: 0.1.1
published about 2 years ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v4 composite
- github/super-linter v5 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- pypa/gh-action-pypi-publish release/v1 composite
- actions/checkout v4 composite
- actions/setup-python v4 composite
- python 3.7 build
- tensorflow >=2.9
- actions/checkout v4 composite