Skip to main content

llama-index llms gaudi integration

Project description

LlamaIndex Llms Integration with Intel Gaudi

Installation

pip install --upgrade-strategy eager optimum[habana]
pip install llama-index-llms-gaudi
pip install llama-index-llms-huggingface

Usage

import argparse
import os, logging
from llama_index.llms.gaudi import GaudiLLM


def setup_parser(parser):
    parser.add_argument(...)
    args = parser.parse_args()
    return args


if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="GaudiLLM Basic Usage Example"
    )
    args = setup_parser(parser)
    args.model_name_or_path = "HuggingFaceH4/zephyr-7b-alpha"

    llm = GaudiLLM(
        args=args,
        logger=logger,
        model_name="HuggingFaceH4/zephyr-7b-alpha",
        tokenizer_name="HuggingFaceH4/zephyr-7b-alpha",
        query_wrapper_prompt=PromptTemplate(
            "<|system|>\n</s>\n<|user|>\n{query_str}</s>\n<|assistant|>\n"
        ),
        context_window=3900,
        max_new_tokens=256,
        generate_kwargs={"temperature": 0.7, "top_k": 50, "top_p": 0.95},
        messages_to_prompt=messages_to_prompt,
        device_map="auto",
    )

    query = "Is the ocean blue?"
    print("\n----------------- Complete ------------------")
    completion_response = llm.complete(query)
    print(completion_response.text)

Examples

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

llama_index_llms_gaudi-0.2.2.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

llama_index_llms_gaudi-0.2.2-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_llms_gaudi-0.2.2.tar.gz.

File metadata

  • Download URL: llama_index_llms_gaudi-0.2.2.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-1021-azure

File hashes

Hashes for llama_index_llms_gaudi-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e2397f5ebfcc8c2d43e50bbf306459cab53c4c887f2c32965e0ab4d394274ade
MD5 c17ff0f7e4f45f055d75aa7e6a96fabf
BLAKE2b-256 c89e0833a601011202d51d2708c81b5e09855e4b5de54d8e9e632c10a1de629f

See more details on using hashes here.

File details

Details for the file llama_index_llms_gaudi-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_llms_gaudi-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 71550c1d5d5fd474546c62d4ac09cf4b0bf0dd82e8a563c66d41742337ad4c80
MD5 b889a850464fd440bd606dbff31e1234
BLAKE2b-256 29ca8a413e8470e2047e7663cf867789968343c72e40a0b17d42e0b5b22606e3

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