Spaces:
Runtime error
Runtime error
Merge branch 'main' of hf.co:spaces/caltech-animal-tracking/Primate_Batch_Detection
Browse files
README.md
CHANGED
|
@@ -4,10 +4,149 @@ emoji: π»
|
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: gray
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 5.
|
| 8 |
app_file: app_batch.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: gray
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.46.0
|
| 8 |
app_file: app_batch.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# Primate Batch Detection: Installation & Troubleshooting Guide
|
| 17 |
+
|
| 18 |
+
## Installation Guide
|
| 19 |
+
|
| 20 |
+
### Prerequisites
|
| 21 |
+
- Computer with GPU, this guide has been tested on an NVIDIA 4090 and 4060.
|
| 22 |
+
- 20-50 min of time
|
| 23 |
+
|
| 24 |
+
### General Tips
|
| 25 |
+
- Check the troubleshooting guide at the bottom of the page
|
| 26 |
+
- If you have already set up WSL, Docker, or NVIDIA Container Toolkit before, feel free to skip those steps.
|
| 27 |
+
- Use Google / ChatGPT to look up your errors
|
| 28 |
+
- Reread the instructions carefully
|
| 29 |
+
- Proceed forward anyways and see if it causes an issue
|
| 30 |
+
- Anytime a terminal command with $VARIABLE_NAME or \<VARIABLE_NAME\>, it means that you should substitute in your appropriate variable or username, without the $ or < decorators.
|
| 31 |
+
- Try opening and closing the terminal window you're in, or restart your computer.
|
| 32 |
+
|
| 33 |
+
---
|
| 34 |
+
|
| 35 |
+
### 1. Set Up WSL (Windows Users Only)
|
| 36 |
+
|
| 37 |
+
If you're using Windows, you'll need to install the **Windows Subsystem for Linux (WSL)**:
|
| 38 |
+
|
| 39 |
+
We recommend using **Ubuntu 22.04** as your Linux distribution.
|
| 40 |
+
|
| 41 |
+
1. Open Powershell and install the WSL command:
|
| 42 |
+
|
| 43 |
+
```wsl --install Ubuntu```
|
| 44 |
+
|
| 45 |
+
2. Set the default Linux distribution used with WSL:
|
| 46 |
+
|
| 47 |
+
```wsl.exe --set-default Ubuntu```
|
| 48 |
+
|
| 49 |
+
for more information visit: [WSL Installation Guide (Microsoft)](https://learn.microsoft.com/en-us/windows/wsl/install)
|
| 50 |
+
|
| 51 |
+
Now open the WSL terminal through your Start menu.
|
| 52 |
+
|
| 53 |
+
**Important:** Run all following commands in the **WSL terminal**, **not PowerShell**.
|
| 54 |
+
|
| 55 |
+
---
|
| 56 |
+
|
| 57 |
+
### 2. Install Docker (Mac and Linux Users Start Here)
|
| 58 |
+
|
| 59 |
+
Follow these guides to install Docker in your WSL Ubuntu environment:
|
| 60 |
+
|
| 61 |
+
1. Follow this guide using "Prerequisites" and "Install Docker Desktop":
|
| 62 |
+
|
| 63 |
+
- [Install Docker Desktop](https://docs.docker.com/desktop/setup/install/linux/ubuntu/)
|
| 64 |
+
|
| 65 |
+
2. Through the previous link, you should have followed step 1 of "Install using the apt repository" as part of your installation process.
|
| 66 |
+
Now complete steps 2-3 of that section as well:
|
| 67 |
+
|
| 68 |
+
- [Install Docker Engine](https://docs.docker.com/engine/install/ubuntu/)
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
### 3. Install the NVIDIA Container Toolkit
|
| 73 |
+
|
| 74 |
+
This is necessary for GPU support inside Docker containers:
|
| 75 |
+
|
| 76 |
+
**Note:** Most likely, unless you built your own computer recently, you will already have installed NVIDIA drivers for your computer. Feel free to ignore the Prerequisites section.
|
| 77 |
+
|
| 78 |
+
1. Follow the "With apt: Ubuntu, Debian" section, and the "Configuring Docker" section of the "Configuration" section.
|
| 79 |
+
|
| 80 |
+
[NVIDIA Container Toolkit Installation Guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
2. Verify that you've installed correctly using this command:
|
| 84 |
+
```sudo docker run --rm --gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 nvidia-smi```
|
| 85 |
+
|
| 86 |
+
You should see something that looks like this pop up if successful.
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+

|
| 90 |
+
|
| 91 |
+
If not, you should restart the NVIDIA Container Toolkit Installation Guide
|
| 92 |
+
|
| 93 |
+
---
|
| 94 |
+
|
| 95 |
+
### 4. Run the Docker Container
|
| 96 |
+
|
| 97 |
+
Use the pre-configured Docker image provided by the Hugging Face Space:
|
| 98 |
+
|
| 99 |
+
[Run Docker Container](https://huggingface.co/spaces/caltech-animal-tracking/Primate_Batch_Detection?docker=true)
|
| 100 |
+
|
| 101 |
+
If you run into the "RuntimeError: Found no NVIDIA driver on your system" error, run this command instead.
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
```sudo docker run --rm -it --gpus all -p 7860:7860 registry.hf.space/caltech-animal-tracking-primate-batch-detection:latest python app_batch.py```
|
| 105 |
+
|
| 106 |
+
**Note:** The first time you've installed the interface on a computer, it will take a while to download, but subsequent startups, just follow steps 4 and 5, and it should be relatively fast to start.
|
| 107 |
+
|
| 108 |
+
### 5. Launch the interface
|
| 109 |
+
|
| 110 |
+
Either click on the **local link** that is given in your WSL terminal, or go to this link in your web browser.
|
| 111 |
+
|
| 112 |
+
<http:/localhost:7860>
|
| 113 |
+
|
| 114 |
+
---
|
| 115 |
+
|
| 116 |
+
## Troubleshooting Guide
|
| 117 |
+
|
| 118 |
+
### π« Error:
|
| 119 |
+
The WSL window crashes immediately upon launch.
|
| 120 |
+
|
| 121 |
+
### π οΈ Fix:
|
| 122 |
+
Double-check that you've done ```wsl --set-default Ubuntu``` in Powershell.
|
| 123 |
+
|
| 124 |
+
### π« Error:
|
| 125 |
+
|
| 126 |
+
```docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]]```
|
| 127 |
+
|
| 128 |
+
### π οΈ Fix:
|
| 129 |
+
This typically means that the **NVIDIA Container Toolkit** was not installed or configured correctly. Double-check your installation by revisiting the [NVIDIA Container Toolkit Guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html).
|
| 130 |
+
|
| 131 |
+
### π« Error:
|
| 132 |
+
```
|
| 133 |
+
docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock:
|
| 134 |
+
Head "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
### π οΈ Fix:
|
| 138 |
+
This error occurs when your user does not have permission to access the Docker socket.
|
| 139 |
+
|
| 140 |
+
You have two options:
|
| 141 |
+
|
| 142 |
+
**Option 1: Add your user to the Docker group**
|
| 143 |
+
```
|
| 144 |
+
sudo usermod -aG docker $USER
|
| 145 |
+
sudo systemctl restart docker # May not be needed or available in WSL
|
| 146 |
+
```
|
| 147 |
+
Then restart your terminal or log out and back in for the group change to take effect.
|
| 148 |
+
|
| 149 |
+
**Option 2: Use sudo for all your docker commands**
|
| 150 |
+
```
|
| 151 |
+
sudo docker $YOUR_COMMAND
|
| 152 |
+
```
|