Skip to main content

A Python Wrapper for Dalai

Project description

dalaipy

A Python Wrapper for Dalai!

Dalai is a simple, and easy way to run LLaMa and Alpaca locally.

Installation

pip install dalaipy==2.0.2

https://pypi.org/project/dalaipy/2.0.2/

Instructions

  1. Go to Dalai, and set up your model of choice on your system (either Mac, Windows, or Linux). The readme provides clear explanations!
  2. Once you can run npx dalai serve, run the server and test out your model of choice.
  3. Install dalaipy per the instructions above, and make your first request:
from dalaipy.src import Dalai

model = Dalai()
# your_model can be one of the following, "alpaca.7B", "alpaca.13B", "llama.7B", "llama.13B", "llama.30B", or "llama.65B", and is dictated by which model you installed
request_dict = model.generate_request("What is the capital of the United States?", your_model)
print(model.request(request_dict))

Credits

@cocktailpeanut - the owner of Dalai

@quadrismegistus - made a notebook with the original idea of using python-socketio to communicate with the web server

Docs

Dalai Class

  • generate_request() - model.generate_request(prompt, model)

    • prompt: (required) the prompt string
    • model: (required) the model that should be used, in the form of a string
      • alpaca.7B
      • alpaca.13B
      • llama.7B
      • llama.13B
      • llama.30B
      • llama.65B
    • id: the request ID (defaut is '0')
    • n_predict: the number of tokens to return (default is 128)
    • repeat_last_n: default is 64
    • repeat_penalty: default is 1.3
    • seed: the seed (default is -1)
    • temp: the temperature of the request (default is 0.5)
    • threads: the number of threads to use (default is 4)
    • top_k: default is 40
    • top_p: default is 0.9
  • request() - model.request(prompt)

    • prompt: (required) the prompt string
    • prettify: whether or not to clean and output just the string, or the whole request dictionary (default is True)

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

dalaipy-2.0.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

dalaipy-2.0.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file dalaipy-2.0.2.tar.gz.

File metadata

  • Download URL: dalaipy-2.0.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for dalaipy-2.0.2.tar.gz
Algorithm Hash digest
SHA256 493187643ef7b0d03a6dea2034fd9d7b5b41f020a62b74f2d2b00e3c59f98236
MD5 457377fbe33c85bfb45c6d24d1bd7c12
BLAKE2b-256 155278808d5404efb9a1bdae624e96b4cd75351ac94776b9f416a745a682b04a

See more details on using hashes here.

File details

Details for the file dalaipy-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: dalaipy-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for dalaipy-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c1a3a1893a413e7a8f14889cab2b2f10bf81f22cd54b41c1917e5a2e2fa6cdbb
MD5 8ee0bbc3ddca47e6d62934c0192d55ac
BLAKE2b-256 f3f3760243b546fe6041c8c34da65b376bfe4535c2637b8c5a3983c3991be59d

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