Instructions to use bpan/LangNav-Sim2k-Llama2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bpan/LangNav-Sim2k-Llama2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bpan/LangNav-Sim2k-Llama2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("bpan/LangNav-Sim2k-Llama2") model = AutoModelForCausalLM.from_pretrained("bpan/LangNav-Sim2k-Llama2") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use bpan/LangNav-Sim2k-Llama2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bpan/LangNav-Sim2k-Llama2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bpan/LangNav-Sim2k-Llama2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/bpan/LangNav-Sim2k-Llama2
- SGLang
How to use bpan/LangNav-Sim2k-Llama2 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 "bpan/LangNav-Sim2k-Llama2" \ --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": "bpan/LangNav-Sim2k-Llama2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "bpan/LangNav-Sim2k-Llama2" \ --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": "bpan/LangNav-Sim2k-Llama2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use bpan/LangNav-Sim2k-Llama2 with Docker Model Runner:
docker model run hf.co/bpan/LangNav-Sim2k-Llama2
LangNav: Language as a Perceptual Representation for Navigation
About LangNav
LangNav is an LLM-based navigation agent which performs multi-step navigation end-to-end via textual descriptions of the scene. The language-based perceptual representation makes LangNav more data efficient compared to VL models. With only a few language-based trajectories from a R2R environment, we use GPT-4 to efficiently generate a huge amount of synthetic training data. A smaller language model (LLaMA2-7B) can then be trained on these synthetic data and do the task. In this repo, we provide the inference code, the model, and the training dataset we used for the paper:
LangNav: Language as a Perceptual Representation for Navigation
Bowen Pan, Rameswar Panda, SouYoung Jin, Rogerio Feris, Aude Oliva, Phillip Isola, Yoon Kim
NAACL 2024 (Findings)
Prerequisites
We don't have to install the Matterport3D Simulator as we have pre-extracted the caption of each viewpoint.
But we still need to prepare the data in directories
- MP3D navigability graphs:
connectivity- Download the connectivity maps [23.8MB].
- R2R data:
data- Download the R2R data [5.8MB].
- BLIP caption of the scene:
img_features- Download the caption data [113MB] (r2r_blip_DETR_vis2text).
Install the Pytorch-Transformers.
Multi-step Navigation with Language-based Representation
Evaluate our LangNav-Sim2k-Llama2 model on the R2R datasets.
sh eval_scripts/eval_langnav_2k_synthetic_100_real.sh
We will also release the synthetic training dataset and the other models. Stay tuned!
Citation
If you use or discuss our LangNav, please cite our paper:
@article{pan2023langnav,
title={Langnav: Language as a perceptual representation for navigation},
author={Pan, Bowen and Panda, Rameswar and Jin, SouYoung and Feris, Rogerio and Oliva, Aude and Isola, Phillip and Kim, Yoon},
journal={arXiv preprint arXiv:2310.07889},
year={2023}
}
- Downloads last month
- 3