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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_index_llms_gaudi-0.3.0.tar.gz.
File metadata
- Download URL: llama_index_llms_gaudi-0.3.0.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b12af7955fd9bb92692fdd9c8160cc8b1aebefb179e1a4c0e9966650b7569ff
|
|
| MD5 |
0c3596519dcf8b5963c21986825b804c
|
|
| BLAKE2b-256 |
c6e68b157136b9274f97efc58156605b1316acfb6d1cf5ba0204995f286cde93
|
File details
Details for the file llama_index_llms_gaudi-0.3.0-py3-none-any.whl.
File metadata
- Download URL: llama_index_llms_gaudi-0.3.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d2b8e0035326af5d1c4267030738bfae9b7ba6a50636a3519f15913f9840b8e
|
|
| MD5 |
88177d7fb6cd9dc4bbd9eb0a31b30e06
|
|
| BLAKE2b-256 |
fa58721e56003749e6d96dae8f27f7dc086940f32e71a10e4db3b99b522175e3
|