Package: isab
Induced Set Attention BlockSet Transformer from the paper "Set Transformer: A Framework for Attention-based Permutation-Invariant Neural Networks" is based on Isab, an attention scheme inspired by inducing point methods from sparse Gaussian process literature and making it permutation invariant. It proposes to reduce attention from O(n²) to O(mn), where m is the number of inducing points (learned latents).InstallationRun the following to install:pipinstallisabDeveloping isabTo installisab, along with tools you need to develop and test, run the following in your virtualenv:gitclonehttps://github.com/Rishit-dagli/isab.git# or clone your own forkcdisab
pipinstall-e.[dev]To run rank and shape tests run any of the following:python-misab.test_isabpytestisab--verboseUsageimporttensorflowastffromisabimportIsabattn=Isab(dim=512,heads=8,num_latents=128)seq=tf.random.normal((1,16384,512))# (batch, seq, dim)mask=tf.ones((1,16384),dtype=tf.bool)# (batch, seq)out,latents=attn(seq,mask=mask)# (1, 16384, 512), (1, 128, 512)You can also choose not to set the number of latents, and pass in the latents yourself:importtensorflowastffromisabimportIsabattn=Isab(dim=512,heads=8)seq=tf.random.normal((1,16384,512))# (batch, seq, dim)latents=tf.Variable(tf.random.normal((128,512)))# some memory, passed through multiple Isabsout,new_latents=attn(seq,latents)# (1, 16384, 512), (1, 128, 512)Want to Contribute 🙋‍♂️?Awesome! If you want to contribute to this project, you're always welcome! SeeContributing Guidelines. You can also take a look atopen issuesfor 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 canstart discussions.Citation@misc{https://doi.org/10.48550/arxiv.1810.00825,doi={10.48550/ARXIV.1810.00825},url={https://arxiv.org/abs/1810.00825},author={Lee, Juho and Lee, Yoonho and Kim, Jungtaek and Kosiorek, Adam R. and Choi, Seungjin and Teh, Yee Whye},keywords={Machine Learning (cs.LG), Machine Learning (stat.ML), FOS: Computer and information sciences, FOS: Computer and information sciences},title={Set Transformer: A Framework for Attention-based Permutation-Invariant Neural Networks},publisher={arXiv},year={2018},copyright={arXiv.org perpetual, non-exclusive license}}@misc{https://doi.org/10.48550/arxiv.2212.11972,doi={10.48550/ARXIV.2212.11972},url={https://arxiv.org/abs/2212.11972},author={Jabri, Allan and Fleet, David and Chen, Ting},keywords={Machine Learning (cs.LG), Computer Vision and Pattern Recognition (cs.CV), Neural and Evolutionary Computing (cs.NE), FOS: Computer and information sciences, FOS: Computer and information sciences},title={Scalable Adaptive Computation for Iterative Generation},publisher={arXiv},year={2022},copyright={Creative Commons Attribution 4.0 International}}LicenseCopyright 2020 Rishit Dagli

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.