File size: 2,488 Bytes
d3b61f8
 
ae85b97
d3b61f8
 
 
 
 
 
 
ae85b97
 
d3b61f8
 
 
 
 
 
 
 
ae85b97
d3b61f8
 
 
 
 
 
 
 
ae85b97
d3b61f8
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# PixelOne inference runtime

One inference-only package supports both **PixelOne-Pro-4B** and **PixelOne-Pro-35B-A3B**. Training, teacher search, dataset preparation and checkpoint export live in the [GitHub research repository](https://github.com/tiankanghui/PixelOne), not in this runtime.

## Install

Use Python 3.12 with CUDA-enabled PyTorch 2.11. The released mixed-precision weights require CUDA. Authenticate with `hf auth login` if the model repository is private.

```bash
python -m pip install -U huggingface_hub
hf download KangHui2200/PixelOne --include 'runtime/*' --local-dir ./PixelOne
python -m pip install ./PixelOne/runtime
python -m pip install flash-linear-attention==0.4.2 causal-conv1d==1.7.0 --no-build-isolation
```

The inference-only distribution and the full GitHub package use the same `pixelone-grounding` package name and API version. Install one in a dedicated environment, not both together. Pin the Hugging Face commit with `hf download --revision COMMIT` and the loader's `revision` argument for reproducibility.

## Predict

```bash
pixelone infer --model KangHui2200/PixelOne --subfolder PixelOne-Pro-4B \
  --image screenshot.png --instruction "Click the search button" --device cuda:0
```

```python
from PIL import Image
from pixelone import PixelOnePredictor

predictor = PixelOnePredictor.from_pretrained(
    "KangHui2200/PixelOne", subfolder="PixelOne-Pro-4B", device="cuda:0",
)
with Image.open("screenshot.png") as screenshot:
    result = predictor.predict(screenshot, "Click the search button")
print(result["point"])
```

Use `PixelOne-Pro-35B-A3B` for the larger model. The loader downloads only the selected model's required files. For offline inference, download the shared `runtime/*` and the selected model directory, install the runtime, then pass the local model directory to the loader.

Coordinates are original-image pixel centers. Screenshots are padded to stride 32, never silently resized. The decoder selects a token first and then a valid pixel inside it. Keep the loader's BF16/FP32 partition and native attention/kernel settings; do not cast the whole model to BF16 or FP16. `kernel_backend="torch"` is a diagnostic alternative, not the paper's latency configuration.

The seven `videojev_hf` modules retain the upstream architecture and its internal dependencies. They are required by the custom model, not a second training package. Licenses and attribution are included in `THIRD_PARTY_NOTICES.md` and `third_party/`.