| Quick Start: Running husim_server Locally | |
| This guide walks you through how to run the husim_server locally. If you can complete this setup on your machine, the same approach will work in the competition environment. | |
| **1. Clone the Repository** | |
| Clone server code: | |
| ```bash | |
| git clone --branch hf-competitions --single-branch [email protected]:longxiaofei/HUGSIM.git | |
| ``` | |
| **2. Build the Docker Image** | |
| Navigate to the project directory and build the Docker image: | |
| ```bash | |
| docker build . -f ./docker/web_server_dockerfile -t hugsim_server:local | |
| ``` | |
| **3. Run the Docker Container** | |
| Run the server locally on port 7860: | |
| ```bash | |
| docker run -d -p 7860:7860 --name hugsim_server hugsim_server:local | |
| ``` | |
| **4. Install the Client** | |
| Install the hugsim_client package: | |
| ```bash | |
| pip install --upgrade hugsim_client | |
| ``` | |
| **5. Using the Client** | |
| ```python | |
| from hugsim_client import HugsimClient | |
| client = HugsimClient() | |
| # Get the current state of the environment | |
| client.get_current_state() | |
| # Reset the environment | |
| client.reset_env() | |
| # Execute an action in the environment (replace `xxx` with your action) | |
| client.execute_action(xxx) | |
| ``` | |
| The full example: [ltf_e2e.py](https://huggingface.co/Libra-1995/navsim/blob/main/ltf_e2e.py) | |