semvec/pypi-packages huggingface dataset:
expiring-cache 1.0.0
A simple Python dict with TTL support for auto-expiring caches with support for case-insensitive keys.
License: MIT
Requires Python: >3.7.0

# expiring-cache

A simple Python dict with TTL support for auto-expiring caches with support for case-insensitive keys.

## Installation

```python
pip install expiring-cache
```

## Features

- TTL support for auto-caching
- Case-insensitive keys support

## Usage

Example 1:

```python
import time
from cache import ExpiringCache

cache = ExpiringCache(2) # Keys will exist for 2 seconds.

cache['ABC'] = 'Example value'
print(cache['ABC']) # Prints the 'Example Value'
time.sleep(2)
print(cache['ABC']) # Raises KeyError
```

Example 2: (shows case-insensitive feature)

```python
import time
from cache import ExpiringCache

cache = ExpiringCache(2, case_insensitive=True)

cache['ABC'] = 'Example value'
print(cache['ABC'])
print(cache['abc'])
# Both print statements above print the exact same 'Example Value'

time.sleep(2)
print(cache['ABC'])
print(cache['abc'])
# Both the print statements above raise KeyError
```
timg 1.1.6
print an image in terminal
License: MIT

# timg
Display an image in terminal.

# Setup 
`timg` is available as a package on PyPI:

    $ pip install timg

Now you can use the `timg` command in your terminal.

# Screenshots
![](https://i.imgur.com/oJbbsEe.png)
![](https://i.imgur.com/E95M3SJ.png)

# Usage
        usage: timg [-h] [-V] [-i] [-m METHOD] [-r N] [-s W] [filename]

        print an image in terminal

        positional arguments:
          filename              filename of an image

        optional arguments:
          -h, --help            show this help message and exit
          -V, --version         print version and exit
          -i, --invert-background
                                invert grayscale in ASCII mode
          -m METHOD, --method METHOD
                                name of a rendering method (use `-m list` to list
                                available methods, the default is a24h)
          -r N, --reduce-colors N
                                reduce color palette of an input image (1-256)
          -s W, --size W        width of an image

# zsh completions
Add this line to `.zshrc`

    compdef _gnu_generic timg
aft-pt 0.1.0
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/ShenDezhou/aft-pytorch/blob/master/pic.png" width=650>

## Installation
You can install `aft_pt` via `pip`:

```bash
pip install aft_pt
```

## 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_pt 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_pt 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_pt 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`
- [ ] Benchmark using Karpathy's [minGPT](https://github.com/karpathy/minGPT)

## 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/ShenDezhou/aft-pytorch/blob/main/LICENSE)