File size: 2,730 Bytes
40fa6ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Deploy MolmoAct2 as a HuggingFace Docker Space

This folder IS the Space contents (`Dockerfile`, `README.md`, `requirements.txt`,
`molmoact2_server.py`). `molmoact2_server.py` is a copy of the canonical
`../molmoact2_server.py` β€” after editing the canonical server, re-copy it:

```bash
cp ../molmoact2_server.py molmoact2_server.py
```

## Target
Space `NoriRobotics/molmoact2-space` (private, Docker SDK, GPU hardware).

## Path A β€” scripted (create repo + upload folder)
Uses the org token already in `nori-backend/.env` (`HF_ORG_ADMIN_TOKEN`), read
in-process, never printed. From `cloud_inference/space/`:

```bash
python - <<'PY'
import os
from dotenv import load_dotenv
from huggingface_hub import HfApi
load_dotenv("/Users/michael/Documents/Nori-Robotics/nori-backend/.env")
api = HfApi(token=os.environ["HF_ORG_ADMIN_TOKEN"])
repo = "NoriRobotics/molmoact2-space"
api.create_repo(repo, repo_type="space", space_sdk="docker", private=True, exist_ok=True)
api.upload_folder(repo_id=repo, repo_type="space", folder_path=".")
print("uploaded ->", repo)
PY
```

Creating the Space defaults to **free CPU** hardware; a CPU box cannot load the
model. After upload, finish in the UI (Path B steps 2-3).

## Path B β€” UI
1. huggingface.co β†’ New Space β†’ owner `NoriRobotics`, SDK **Docker**, **private**.
   Clone it, copy this folder's files in, `git add . && git commit && git push`.
2. **Settings β†’ Variables and secrets**: add secret `NORI_INFER_TOKEN` (the bearer
   token the rollout sends). Add `HF_TOKEN` only if the model repo is gated.
3. **Settings β†’ Hardware**: pick a GPU β€” `a10g-small` (~$1/hr) is enough.

## Verify
First boot downloads ~21GB. Poll health (no auth needed):

```bash
curl -s https://noribotics-molmoact2-space.hf.space/health
# {"ok":false,"status":"loading",...}  ->  {"ok":true,"status":"ready",...}
```

Smoke-test `/act` (needs the token; keep it out of shell history β€” read from a file):

```bash
TOKEN=$(cat ~/.nori_infer_token)   # or your secret manager
curl -s https://noribotics-molmoact2-space.hf.space/act \
  -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d '{"images":["<b64-jpeg>","<b64-jpeg>"],"state":[0,0,0,0,0,0],
       "instruction":"pick up the red cup","num_steps":10}'
# -> {"actions":[[...6...], ...]}   ~30 moves, robot scale
```

The exact subdomain is shown on the Space page (Embed β†’ Direct URL). It is
`https://<owner>-<space-name>.hf.space`, lowercased with `/` β†’ `-`.

## Cost note
A GPU Space bills while **Running**. Set **Sleep after inactivity** in Settings
(e.g. 15 min) for the spike so it pauses when idle; the robot rollout wakes it
(cold start β‰ˆ first-boot download unless persistent storage is attached).