Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -39,7 +39,22 @@ Serving them from the HF Hub is reliable from HF's build infrastructure.
|
|
| 39 |
|
| 40 |
## Usage
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
```python
|
| 45 |
from huggingface_hub import hf_hub_download
|
|
@@ -49,13 +64,12 @@ encoder_ckpt = hf_hub_download(REPO, "k400_clip_complete_finetuned_30_epochs.
|
|
| 49 |
classifier_ckpt = hf_hub_download(REPO, "best_detector_model.pt")
|
| 50 |
```
|
| 51 |
|
| 52 |
-
|
| 53 |
-
[`aitf-its-tim3-dfk/david`](https://github.com/aitf-its-tim3-dfk/david)):
|
| 54 |
|
| 55 |
```python
|
| 56 |
import torch
|
| 57 |
-
from encoder import load_feature_extractor
|
| 58 |
-
from model import ClassificationHead
|
| 59 |
|
| 60 |
feature_extractor = load_feature_extractor(
|
| 61 |
arch="ViT-B/16",
|
|
|
|
| 39 |
|
| 40 |
## Usage
|
| 41 |
|
| 42 |
+
### 1. Get the model code from GitHub
|
| 43 |
+
|
| 44 |
+
The model definitions (`model.py`, `encoder.py`, and the `clip/` package) are
|
| 45 |
+
**not** in this weights repo — they live in the training repo
|
| 46 |
+
[**`aitf-its-tim3-dfk/david`**](https://github.com/aitf-its-tim3-dfk/david)
|
| 47 |
+
(branch `feat-cddb`). Clone it first and run from inside it:
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
+
git clone -b feat-cddb https://github.com/aitf-its-tim3-dfk/david
|
| 51 |
+
cd david
|
| 52 |
+
pip install -r requirements.txt
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
This is what makes `from model import ...` and `from encoder import ...` below work.
|
| 56 |
+
|
| 57 |
+
### 2. Download the checkpoints (no auth needed — public repo)
|
| 58 |
|
| 59 |
```python
|
| 60 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 64 |
classifier_ckpt = hf_hub_download(REPO, "best_detector_model.pt")
|
| 65 |
```
|
| 66 |
|
| 67 |
+
### 3. Load and run
|
|
|
|
| 68 |
|
| 69 |
```python
|
| 70 |
import torch
|
| 71 |
+
from encoder import load_feature_extractor # from the cloned GitHub repo
|
| 72 |
+
from model import ClassificationHead # from the cloned GitHub repo
|
| 73 |
|
| 74 |
feature_extractor = load_feature_extractor(
|
| 75 |
arch="ViT-B/16",
|