Instructions to use voxreality/llama2-navigation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use voxreality/llama2-navigation with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="voxreality/llama2-navigation") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("voxreality/llama2-navigation") model = AutoModelForCausalLM.from_pretrained("voxreality/llama2-navigation") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use voxreality/llama2-navigation with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "voxreality/llama2-navigation" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "voxreality/llama2-navigation", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/voxreality/llama2-navigation
- SGLang
How to use voxreality/llama2-navigation with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "voxreality/llama2-navigation" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "voxreality/llama2-navigation", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
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 "voxreality/llama2-navigation" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "voxreality/llama2-navigation", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use voxreality/llama2-navigation with Docker Model Runner:
docker model run hf.co/voxreality/llama2-navigation
Model Description
llama2-navigation is a Larage Language Model (LLM) that is a fine-tuned version of Llama-2-7b-chat-hf. This model aims to provide navigation instructions given knowledge.
The model was fine-tuned with Lora and custom training data. For more details about the model's use case, you can find the code at the following link:
How to Get Started with the Model
Below you can find an example of model usage:
import torch, textwrap
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig, pipeline
from langchain import HuggingFacePipeline, PromptTemplate
from langchain.chains import LLMChain
model_name = "voxreality/llama2-navigation"
user_msg = "I need to go to the social area."
knowledge = "start, move 11, turn left, move 4, turn right, move 3, stairs up, move 12, turn left, move 4, turn left, move 13, turn right, move 5, finish"
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, trust_remote_code=True, device_map="auto")
generation_config = GenerationConfig.from_pretrained(model_name)
generation_config.max_new_tokens = 1024
generation_config.temperature = 0.0001
generation_config.top_p = 0.95
generation_config.do_sample = True
generation_config.repetition_penalty = 1.15
text_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer, generation_config=generation_config)
llm = HuggingFacePipeline(pipeline=text_pipeline, model_kwargs={"temperature": 0})
text_pipeline = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
generation_config=generation_config)
model = HuggingFacePipeline(pipeline=text_pipeline, model_kwargs={"temperature": 0})
prompt = textwrap.dedent("""
[INST] <>
You are a navigation assistant at a conference venue. Your task is to guide users to specific locations within the venue, including "booth 1", "booth 2", "booth 3", "booth 4", "social area", "exit", "business room", and "conference room".
- For clear directions, respond with numbered steps using the details provided in the 'knowledge' field.
- Ensure to translate the directions from the 'knowledge' field into a user-friendly format with clear, numbered steps."
"" \n\n
<>
### input: {input}
### knowledge: {knowledge}
[/INST]
""")
prompt = PromptTemplate(input_variables=["input", "knowledge"], template= prompt)
chain = LLMChain(llm=model, prompt=prompt)
print(chain.run(input=user_msg, knowledge=knowledge))
- Downloads last month
- 5
docker model run hf.co/voxreality/llama2-navigation