Skip to main content

Neural encoders for embedding diverse objects

Project description

Encoders

A library of neural encoders to convert any types of data into embeddings, dense or sparse.

Build a package

python setup.py bdist_wheel
twine upload dist/*

Use Locally

model = EncoderLoader.load_model('pretrain-models', <model_id>, use_gpu=True, region='cn')
model.encode(['I am a good man'], show_progress_bar=True, batch_size=batch_size,)

Use as RESTful API

Start a server

uvicorn soco_encoders.http.main:app --host 0.0.0.0 --port 8000 --workers 4

Start a client

res = requests.post(url='http://localhost:8000/encoder/v1/encode',
                      json={
                          "model_id": model_id,
                          "text": [x1] * batch_size,
                          'batch_size': batch_size,
                          "mode": "default",
                          "kwargs": {}
                      })

Use as GRPC API

Start a server

python -m soco_encoders.grpc.server --host 0.0.0.0 --port 8000 --workers 4

Start a client

   check out example in bench_grpc.py

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

soco-encoders-0.2.9.2.tar.gz (33.3 kB view details)

Uploaded Source

File details

Details for the file soco-encoders-0.2.9.2.tar.gz.

File metadata

  • Download URL: soco-encoders-0.2.9.2.tar.gz
  • Upload date:
  • Size: 33.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.2

File hashes

Hashes for soco-encoders-0.2.9.2.tar.gz
Algorithm Hash digest
SHA256 29097f0d2f740116026f420da2270d4b2a9ce3835ac1a3ada56fa95d3f054e76
MD5 0aed0504ad8ad32e098db0504567120d
BLAKE2b-256 d19cc90fba422d9b7a6ed881ec70eea113aa96b2a7179fea3d3ca80e531039d0

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