Skip to main content

The EmbeddingRWKV Model

Project description

The RWKV-X Language Model

https://github.com/howard-hou/EmbeddingRWKV

# !!! set these before import RWKV !!!
import os

os.environ["RWKV_CUDA_ON"] = '0' # '1' to compile CUDA kernel (10x faster), requires c++ compiler & cuda libraries

from rwkv_emb.model import EmbeddingRWKV

EOS_INDEX = 65535
# download models: to be announced
model = EmbeddingRWKV(model_path='path-to-model', strategy='cpu fp32')


# !!! model.forward(tokens, state) will modify state in-place !!!

emb, state = model.forward([187, 510, 1563, 310, 247, EOS_INDEX], None)
print(emb.detach().cpu().numpy())                   # get logits
emb, state = model.forward([187, 510], None)
emb, state = model.forward([1563], state)           # RNN has state (use deepcopy to clone states)
emb, state = model.forward([310, 247, EOS_INDEX], state)
print(emb.detach().cpu().numpy())                   # same result as above
print('\n')

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

rwkv_emb-0.0.3.tar.gz (393.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rwkv_emb-0.0.3-py3-none-any.whl (392.9 kB view details)

Uploaded Python 3

File details

Details for the file rwkv_emb-0.0.3.tar.gz.

File metadata

  • Download URL: rwkv_emb-0.0.3.tar.gz
  • Upload date:
  • Size: 393.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for rwkv_emb-0.0.3.tar.gz
Algorithm Hash digest
SHA256 78415e1deceff77a787ca266360a3e94c8b086ffa9f33772ddca36bdda3011e7
MD5 1a1ce7d06325e58114a41dbb2550a3f3
BLAKE2b-256 47cbfd4a58ccc21c9a54f3d90704ff0b2ba379b4cbc60ee3062c38b73dbdde57

See more details on using hashes here.

File details

Details for the file rwkv_emb-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: rwkv_emb-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 392.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for rwkv_emb-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3a4c9c196cc199f08012f2aae00ad085ddb542fe9324059d85cc1f6367799c6a
MD5 9a1658c222713bfdaf3a0ce9eccfa174
BLAKE2b-256 4c4dafd6cb19ffb5077a2c0b52279061992003291a44a021a41a7f42cf3dc2b4

See more details on using hashes here.

Supported by

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