semvec/pypi-packages huggingface dataset:
aft-pytorch 0.2.2
Attention Free Transformer - Pytorch
License: MIT
Keywords: artificial intelligence,deep learning,attention free transformer,self-attention,transformer,natural language processing

# aft-pytorch
Unofficial PyTorch implementation of **Attention Free Transformer**'s layers by [Zhai](https://twitter.com/zhaisf?lang=en), et al. [[abs](https://openreview.net/forum?id=pW--cu2FCHY), [pdf](https://arxiv.org/pdf/2105.14103.pdf)] from Apple Inc.

<img src="https://github.com/rish-16/aft-pytorch/raw/main/pic.png" width=650>

## Installation
You can install `aft-pytorch` via `pip`:

```bash
pip install aft-pytorch
```

## Usage
You can import the **AFT-Full** or **AFT-Simple** layer (as described in the paper) from the package like so:

### `AFTFull`
```python
from aft_pytorch import AFTFull

layer = AFTFull(
    max_seqlen=20,
    dim=512,
    hidden_dim=64
)

# a batch of sequences with 10 timesteps of length 512 each
x = torch.rand(32, 10, 512)
y = layer(x) # [32, 10, 512]
```

### `AFTSimple`
```python
from aft_pytorch import AFTSimple

layer = AFTSimple(
    max_seqlen=20,
    dim=512,
    hidden_dim=64
)

# a batch of sequences with 10 timesteps of length 512 each
x = torch.rand(32, 10, 512)
y = layer(x) # [32, 10, 512]
```
### `AFTLocal`
```python
from aft_pytorch import AFTLocal

layer = AFTLocal(
    max_seqlen=20,
    dim=512,
    hidden_dim=64
)

# a batch of sequences with 10 timesteps of length 512 each
x = torch.rand(32, 10, 512)
y = layer(x) # [32, 10, 512]
```

> This layer wrapper is a 'plug-and-play' with your existing networks / Transformers. You can swap out the Self-Attention layer with the available layers in this package with minimal changes.

## TODO
- Add full AFT architecture
- Add variants like, `AFTConv`, `AFTLocal`

## Contributing
If you like this repo, please leave a star! If there are any amends or suggestions, feel free to raise a PR/issue.

## Credits
```
@misc{attention-free-transformer,
title = {An Attention Free Transformer},
author = {Shuangfei Zhai and Walter Talbott and Nitish Srivastava and Chen Huang and Hanlin Goh and Ruixiang Zhang and Josh Susskind},
year = {2021},
URL = {https://arxiv.org/pdf/2105.14103.pdf}
}
```

## License
[MIT](https://github.com/rish-16/aft-pytorch/blob/main/LICENSE)
playwavemusic 0.1.1
Allows you to manipulate music in WAVE/WAV files.
License: MIT
Keywords: SOME,MEANINGFULL,KEYWORDS

playwavemusic
=============

playwavemusic is a Python library for manipulating music(WAVE or WAV
files).

Installation
------------

Use the package manager `pip <https://pip.pypa.io/en/stable/>`__ to
install playwavemusic.

.. code:: bash

    pip install playwavemusic

Usage
-----

play music from wavfile:

.. code:: python

    import playwavemusic

    if __name__ == "__main__":
        process = playwavemusic.playMusic("alarm.wav", loop=False threaded=False)

play music on loop:

.. code:: python

    import playwavemusic

    if __name__ == "__main__":
        process = playwavemusic.playMusic("alarm.wav", loop=True, threaded=True)

    play music asynchronous:
    import playwavemusic

    if __name__ == "__main__":
        process = playwavemusic.playMusic("alarm.wav", loop=False, threaded=True)

stop all sounds:

.. code:: python

    import playwavemusic, time

    if __name__ == "__main__":
        process = playwavemusic.playMusic("alarm.wav", loop=True, threaded=True)
        time.sleep(1)
        playmusic.stopAllSounds()

stop specific sound:

.. code:: python

    import playwavemusic, time

    if __name__ == "__main__":
        process = playwavemusic.playMusic("alarm.wav", loop=True, threaded=True)
        process2 = playwavemusic.playMusic("alarm2.wav", loop=True, threaded=True)
        time.sleep(1)
        playmusic.stopSpecificSound(process)

stop specific sounds:

.. code:: python

    import playwavemusic, time

    if __name__ == "__main__":
        sounds_to_stop = []
        process = playwavemusic.playMusic("alarm.wav", loop=True, threaded=True)
        sounds_to_stop.append(process)
        process2 = playwavemusic.playMusic("alarm2.wav", loop=True, threaded=True)
        time.sleep(1)
        playmusic.stopSpecificSounds(sounds_to_stop)

Contributing
------------

Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.

Please make sure to update tests as appropriate.

License
-------

`MIT <https://choosealicense.com/licenses/mit/>`__
semantic-search-faiss 0.1.0
Semantic search to query covid related papers
License: MIT
Keywords: natural language processing,semantic search,pytorch

# Semantic search with FAISS

The idea of this project is to build a semantic search engine which can search across multiple research papers related to covid and return the response. This can pretty much help people who want to know about ongoing research with respect to covid'19

I have used - `retrieval-ranking method with faiss index` approach for the faster retrieval of data for the given query.


## Installation

`pip install semantic-search-faiss`


## Inference example

```python
from semanticsearch import search,utils,config
from semanticsearch.pretrained import get_model
from sentence_transformers import CrossEncoder

bi_encoder,index,documents=get_model(config.BI_ENCODER,config.INDEX,config.DATA)
cross_encoder = CrossEncoder(config.CROSS_ENCODER)

query='death rates of covid'
results=search.search(query,index,bi_encoder,cross_encoder,documents)

```

## Training pipeline

```

1. Synthetic query generation using T5
2. Finetuning Bi-encoder using the synthetic query
3. Indexing the data with FAISS using finetuned BI-encoder
4. Bi-encoder + Cross encoder with FAISS search

```
Try out the code on google colab.

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1f4fm6RD08Llc15kG7q-wCt7YQUi-aAn7?usp=sharing)


## Kaggle

Detailed walk through of the solution can be found in the below kaggle notebook

[![Kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://www.kaggle.com/nandhuelan/semantic-search)



## Acknowledgements

I would like to thank Kaggle community as a whole for providing an avenue to learn and discuss latest data science/machine learning advancements.

1. Vladimir Iglovikov for his wonderful article ["I trained a model. What is next?"](https://ternaus.blog/tutorial/2020/08/28/Trained-model-what-is-next.html)

2. [Xhululu](https://www.kaggle.com/xhlulu/cord-19-eda-parse-json-and-generate-clean-csv) for the dataset.