teknium/openhermes
Viewer • Updated • 243k • 1.21k • 229
How to use aloobun/llama2-7b-openhermes-15k-mini with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="aloobun/llama2-7b-openhermes-15k-mini") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("aloobun/llama2-7b-openhermes-15k-mini")
model = AutoModelForCausalLM.from_pretrained("aloobun/llama2-7b-openhermes-15k-mini", device_map="auto")How to use aloobun/llama2-7b-openhermes-15k-mini with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "aloobun/llama2-7b-openhermes-15k-mini"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "aloobun/llama2-7b-openhermes-15k-mini",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/aloobun/llama2-7b-openhermes-15k-mini
How to use aloobun/llama2-7b-openhermes-15k-mini with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "aloobun/llama2-7b-openhermes-15k-mini" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "aloobun/llama2-7b-openhermes-15k-mini",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "aloobun/llama2-7b-openhermes-15k-mini" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "aloobun/llama2-7b-openhermes-15k-mini",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use aloobun/llama2-7b-openhermes-15k-mini with Docker Model Runner:
docker model run hf.co/aloobun/llama2-7b-openhermes-15k-mini
It is a 4-bit qlora refinement of llama-v2-guanaco, fine tuned on the 15k rows of Hermes dataset.
from transformers import AutoTokenizer
import transformers
import torch
model = "aloobun/llama2-7b-openhermes-15k-mini"
prompt = "What are large language models?"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
"text-generation",
model=model,
torch_dtype=torch.float16,
device_map="auto",
)
sequences = pipeline(
f'[INST] {prompt} [/INST]',
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
max_length=200,
)
for seq in sequences:
print(f"Result: {seq['generated_text']}")
Result: [INST] What are large language models? [/INST] Large language models are artificial intelligence systems that can be trained on vast amounts of text to generate human-like language. Libraries of natural language processing (NLP) algorithms like BERT and GPT have allowed these systems to learn and improve their capacity for language understanding and generation. These language models have found applications in natural language translation, text summarization, chatbots, and even creative writing. They can help in tasks like predicting the next word in a sentence or even generating a whole text based on a given topic or prompt. Large language models have the potential to revolutionize many industries, from customer support to content creation and beyond. However, their use and development raise important ethical and societal questions, such as the impact on employment or the potential misuse of generated content. As AI technology continues to advance, the role and capabilities of large language models will continue to evolve.