Skip to main content

finding similar 1-token words on OpenAI's CLIP.

Project description

The clip_similarwords is the implementation of finding similar 1-token words of OpenAI's CLIP in less than one second.

OpenAI's CLIP uses text-image similarities so its text-text similarities may also be text's typical image similarities unlike WordNet or other synonym dictionaries.

Note that, for speed and storage reason (PyPI is limited to 60MB), the words composed by 2 or more tokens are not supported.

Installation

clip_similarwords is easily installable via pip command:

pip install clip_similarwords

or

pip install git+https://github.com/nazodane/clip_similarwords.git

Usage of the command

~/.local/bin/clip-similarwords [ word_fragment | --all ]

Usage of the module

from clip_similarwords import CLIPTextSimilarWords
clipsim = CLIPTextSimilarWords()
for key_token, sim_token, cos_similarity in clipsim("cat"):
    print("%s -> %s ( cos_similarity: %.2f )"%(key_token, sim_token, cos_similarity))

Requirements for model uses

  • Linux (should also works on other environmets)

no PyTorch nor CUDA are required.

Requirements for model generation

  • Linux
  • Python 3.10 or later
  • PyTorch 1.13 or later
  • CUDA 11.7 or later
  • DRAM 16GB or higher
  • RTX 3060 12GB or higher

The patches and informations on other enviroments are surely welcome!

License

The codes are under MIT License. The model was converted under Japanese law.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clip_similarwords-0.0.2.tar.gz (3.8 MB view details)

Uploaded Source

Built Distribution

clip_similarwords-0.0.2-py3-none-any.whl (3.9 MB view details)

Uploaded Python 3

File details

Details for the file clip_similarwords-0.0.2.tar.gz.

File metadata

  • Download URL: clip_similarwords-0.0.2.tar.gz
  • Upload date:
  • Size: 3.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.64.1 urllib3/1.26.12 CPython/3.10.6

File hashes

Hashes for clip_similarwords-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4d4ae81112e922d472eb399b32ccdeff04b6f3dc6d81e808f187627c08e7361d
MD5 f46adf42c2a0dca19b9f9c0858e99616
BLAKE2b-256 1244b23eaaf3446490439801f84b6fed2171373bf0fa7ad8952618ebd09bec76

See more details on using hashes here.

File details

Details for the file clip_similarwords-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: clip_similarwords-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.64.1 urllib3/1.26.12 CPython/3.10.6

File hashes

Hashes for clip_similarwords-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d2f2a6e8d0936ecd36dced056692cf6abebb8589117b5e850391fc41db6003f6
MD5 79f4e2011a73b357fd48ab4c4a57089e
BLAKE2b-256 354bf098e15a38c9df850b9ff2c3e7b399c1692e85a7e6a7202f6400856c6d38

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page