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
21
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.