JSHNSL commited on
Commit
6603bc6
·
verified ·
1 Parent(s): e2cf84e

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +197 -0
README.md ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - robotics
5
+ - deployment
6
+ - inference
7
+ - cyclo-intelligence
8
+ - ffw-sg2
9
+ - lerobot
10
+ - gr00t
11
+ pretty_name: cyclo_intelligence 배포 가이드 (FFW_SG2)
12
+ ---
13
+
14
+ # cyclo_intelligence 배포 — 처음부터 끝까지
15
+
16
+ 학습한 정책(LeRobot ACT/VQ-BeT/Diffusion 또는 GR00T N1.7)을 ROBOTIS **cyclo_intelligence** 웹 UI로
17
+ 로봇에 올려 실행하는 전 과정. **실전에서 실제로 겪은 함정까지** 반영했다.
18
+
19
+ > 학습 파이프라인은 → LeRobot [`humanoid-imitation-learning`](https://huggingface.co/JSHNSL/humanoid-imitation-learning) · GR00T [`gr00t-ffw-sg2-finetune`](https://huggingface.co/JSHNSL/gr00t-ffw-sg2-finetune)
20
+
21
+ ---
22
+
23
+ ## 큰 그림
24
+
25
+ cyclo_intelligence는 여러 컨테이너로 구성된다:
26
+
27
+ | 컨테이너 | 역할 |
28
+ |----------|------|
29
+ | `cyclo_intelligence` | 오케스트레이터 + 웹 UI (nginx) |
30
+ | `lerobot_server` | **LeRobot 정책** 추론 엔진 (`robotis/lerobot-zenoh`) |
31
+ | `groot_server` | **GR00T 정책** 추론 엔진 (`robotis/groot-zenoh`) |
32
+ | `ai_worker` | 로봇 제어 (실물/mock) |
33
+
34
+ 정책 종류에 따라 **다른 엔진**이 뜬다 — LeRobot은 `lerobot_server`, GR00T는 `groot_server`.
35
+
36
+ ---
37
+
38
+ ## 1. 설치
39
+
40
+ [공식 install 스크립트](https://github.com/ROBOTIS-GIT/cyclo_intelligence):
41
+ ```bash
42
+ curl -fsSL https://raw.githubusercontent.com/ROBOTIS-GIT/cyclo_intelligence/main/install.sh | bash
43
+ ```
44
+ - 호스트명이 `ffw` 로 시작하는 **로봇 PC**: `/mnt/ssd/cyclo_intelligence` 에 설치 + `~/cyclo_intelligence` bind-mount
45
+ - 그 외: `~/cyclo_intelligence`
46
+
47
+ 컨테이너 확인:
48
+ ```bash
49
+ cd ~/cyclo_intelligence
50
+ docker ps # cyclo_intelligence, lerobot_server 가 Up (healthy)
51
+ ```
52
+
53
+ ---
54
+
55
+ ## 2. 모델을 어디에 두나 — **가장 중요한 것**
56
+
57
+ 정책은 **`/workspace/model/<backend>/<이름>/`** 에 둔다. 호스트 경로로는:
58
+
59
+ ```
60
+ ~/cyclo_intelligence/docker/workspace/model/lerobot/<이름>/ ← LeRobot 정책
61
+ ~/cyclo_intelligence/docker/workspace/model/groot/<이름>/ ← GR00T 정책
62
+ ```
63
+
64
+ > ⚠️ **`~/.cache/huggingface/...` 가 아니다.** UI가 읽는 드롭박스는 `/workspace/model/{lerobot,groot}/` 다.
65
+ > ⚠️ **학습 컨테이너의 `/workspace` 와 헷갈리지 말 것.** `docker run ... gr00t`(학습용)의 `/workspace` 와
66
+ > cyclo_intelligence의 `/workspace` 는 **다른 컨테이너**다. cyclo 쪽에 둬야 웹에 보인다
67
+ > → 호스트의 `~/cyclo_intelligence/docker/workspace/model/` 에 두는 게 제일 확실.
68
+
69
+ ### 추론에 필요한 파일만 (checkpoint 등은 뺀다)
70
+
71
+ **GR00T** — 7개면 된다:
72
+ ```
73
+ config.json
74
+ model-00001-of-00003.safetensors
75
+ model-00002-of-00003.safetensors
76
+ model-00003-of-00003.safetensors
77
+ model.safetensors.index.json
78
+ experiment_cfg/ ← modality (19-dim/카메라1개) 정보
79
+ processor_config.json (또는 processor/ 폴더)
80
+ ```
81
+ **LeRobot (0.5.2)** — 정규화 파일이 핵심:
82
+ ```
83
+ config.json
84
+ model.safetensors
85
+ policy_preprocessor.json
86
+ policy_preprocessor_step_*_normalizer_processor.safetensors ← 입력 정규화 (필수!)
87
+ policy_postprocessor.json
88
+ policy_postprocessor_step_*_unnormalizer_processor.safetensors ← 출력 역정규화 (필수!)
89
+ train_config.json
90
+ ```
91
+ > ❌ **빼는 것**: `checkpoint-*/`(각 수GB 중복), `optimizer.pt`, `scheduler.pt`, `rng_state.pth`,
92
+ > `trainer_state.json`, `training_args.bin`, `wandb_config.json` — 전부 학습 재개용이라 추론엔 불필요.
93
+ >
94
+ > ⚠️ **LeRobot은 반드시 0.5.2로 학습한 것.** 옛 0.3.3 모델(preprocessor/postprocessor 파일 없음)은
95
+ > 로드돼도 정규화가 안 돼 로봇이 이상하게 움직인다 → 0.5.2로 재학습해야 한다.
96
+
97
+ ---
98
+
99
+ ## 3. HF에서 모델 받아 배치
100
+
101
+ **cyclo_intelligence 캐시가 호스트에 마운트**돼 있으므로 호스트에서 직접 받는 게 깔끔하다.
102
+
103
+ ### GR00T 예시 (HF repo에 checkpoint-* 로 저장된 경우)
104
+
105
+ 최종 스텝만 골라서 받는다:
106
+ ```bash
107
+ # 어떤 체크포인트가 있나
108
+ python3 -c "from huggingface_hub import HfApi; import re; print(sorted({int(m.group(1)) for f in HfApi().list_repo_files('JSHNSL/groot_ffw_ltable') if (m:=re.match(r'checkpoint-(\d+)/',f))}))"
109
+ ```
110
+ ```bash
111
+ # 최종(예: 20000)만 받기
112
+ hf download JSHNSL/groot_ffw_ltable --include "checkpoint-20000/*" --local-dir /tmp/g
113
+ ```
114
+ ```bash
115
+ # 필요한 것만 배치 (한 줄 — 여러 줄로 나누면 공백이 깨진다)
116
+ DST=~/cyclo_intelligence/docker/workspace/model/groot/groot_ffw_ltable_20k
117
+ mkdir -p "$DST"
118
+ cp -a /tmp/g/checkpoint-20000/config.json /tmp/g/checkpoint-20000/model-00001-of-00003.safetensors /tmp/g/checkpoint-20000/model-00002-of-00003.safetensors /tmp/g/checkpoint-20000/model-00003-of-00003.safetensors /tmp/g/checkpoint-20000/model.safetensors.index.json /tmp/g/checkpoint-20000/experiment_cfg /tmp/g/checkpoint-20000/processor_config.json "$DST"/
119
+ ```
120
+ ```bash
121
+ # ⭐ 모델 3개가 GB 단위로 들어갔는지 반드시 확인
122
+ ls -la "$DST"
123
+ ```
124
+
125
+ ### LeRobot 예시 (repo 최상위에 파일이 있는 경우)
126
+
127
+ ```bash
128
+ DST=~/cyclo_intelligence/docker/workspace/model/lerobot/diffusion_ffw
129
+ hf download JSHNSL/diffusion_ffw_ltable --local-dir "$DST"
130
+ ```
131
+
132
+ > 컨테이너가 root로 만든 폴더는 root 소유가 된다. 호스트에서 만지려면 `sudo`, 또는
133
+ > `sudo chown -R $USER:$USER ~/cyclo_intelligence/docker/workspace/model`.
134
+
135
+ ---
136
+
137
+ ## 4. 웹 UI에서 실행
138
+
139
+ 브라우저로 cyclo_intelligence 접속 → **Inference**:
140
+ 1. 모델 타입 — **ACT / VQ-BeT / Diffusion** (LeRobot) 또는 **N1.7** (GR00T)
141
+ 2. User — 폴더 구조상 owner (예: `JSHNSL`) 또는 직접 배치한 이름
142
+ 3. Policy — 방금 배치한 폴더 이름
143
+ 4. **Load** → 로딩되면 **Inference**로 넘어감
144
+
145
+ 성공 로그 (엔진 컨테이너):
146
+ ```bash
147
+ docker logs -f groot_server 2>&1 | grep -v "Service call timed out" # GR00T
148
+ docker logs -f lerobot_server # LeRobot
149
+ ```
150
+ GR00T가 뜨면:
151
+ ```
152
+ Loading GR00T policy from: /workspace/model/groot/groot_ffw_ltable_20k
153
+ Policy info: {'video': ['cam_left_head'], 'state': ['arm_left','arm_right','head','lift'], ...}
154
+ Action chunk: T=16, D=19 ← 추론이 실제로 돌고 있음
155
+ ```
156
+
157
+ ---
158
+
159
+ ## 5. 자주 걸리는 것 (실전)
160
+
161
+ | 증상 | 원인 / 해결 |
162
+ |------|------------|
163
+ | **웹 UI Loading 무한** (GR00T) | `groot_server` 자동 기동 실패 → `docker start groot_server` 후 UI에서 다시 Load |
164
+ | **웹에 모델이 안 보임** | `/workspace/model/<backend>/` 가 아닌 곳에 뒀거나, **학습 컨테이너**의 `/workspace` 에 넣음 → cyclo 쪽 `~/cyclo_intelligence/docker/workspace/model/` 에 배치 |
165
+ | **Diffusion/VQ-BeT 로드는 되는데 로봇 안 움직임** | 큐 기반 정책 엔진 버그 → [`cyclo-intelligence-patches`](https://huggingface.co/JSHNSL/cyclo-intelligence-patches) 한 줄 적용 (`prediction.py` 패치 + `diffusers` 설치) |
166
+ | **`No module named 'diffusers'`** (Diffusion) | `docker exec lerobot_server sh -c 'VIRTUAL_ENV=/lerobot/.venv uv pip install diffusers'` (이 컨테이너엔 pip 없음, uv 사용) |
167
+ | **VQ-BeT 드롭다운에 없음** | UI에 항목 추가 + root로 재빌드 → patches repo 참고 |
168
+ | **ACT는 되는데 접근만 하고 grasp 약함** | 정책 성능/시각 조건 문제 (단일 cam_head). 배포 버그 아님 |
169
+ | **옛 ACT(0.3.3) 로드했는데 이상** | preprocessor/postprocessor 파일 없음 → **0.5.2로 재학습** |
170
+ | **`Timeout waiting for sensors: camera:cam_right_head`** | 로봇 config가 카메라 4개 기대. 정책이 1개만 쓰면 **경고일 뿐 추론은 진행됨** |
171
+ | **카메라 회색 / 로봇 mock** | **실물 로봇·카메라가 없는 PC**라서. 실제 동작은 로봇이 연결된 PC에서만 |
172
+ | 모델 파일 root 소유 | `sudo chown -R $USER:$USER ~/cyclo_intelligence/docker/workspace/model` |
173
+
174
+ ---
175
+
176
+ ## 6. 정책별 요약
177
+
178
+ | 정책 | 엔진 | 배치 위치 | 특이사항 |
179
+ |------|------|-----------|----------|
180
+ | **ACT** | lerobot_server | `model/lerobot/` | 바로 됨 (0.5.2) |
181
+ | **Diffusion** | lerobot_server | `model/lerobot/` | 엔진 패치 + `diffusers` 필요 |
182
+ | **VQ-BeT** | lerobot_server | `model/lerobot/` | 엔진 패치 + UI 항목 추가 필요 |
183
+ | **GR00T N1.7** | groot_server | `model/groot/` | `groot_server` 수동 기동 필요할 수 있음 |
184
+
185
+ > Diffusion·VQ-BeT 관련 패치는 [`JSHNSL/cyclo-intelligence-patches`](https://huggingface.co/JSHNSL/cyclo-intelligence-patches) 에 한 줄 적용 스크립트로 있다.
186
+
187
+ ---
188
+
189
+ ## ⚠️ 실물 로봇이 없는 PC에서는
190
+
191
+ 로드·추론(Action chunk 생성)까지는 되지만, **실제 로봇 움직임은 안 보인다** — 카메라는 회색(mock),
192
+ 관절도 mock. 이 PC에서 확인 가능한 것은:
193
+ - ✅ 모델이 **로드되는가**
194
+ - ✅ modality를 **정확히 인식하는가** (`Policy info`)
195
+ - ✅ **추론이 도는가** (`Action chunk`)
196
+
197
+ **실제 grasp/이동**은 ZED+RealSense가 달린 **실물 FFW_SG2 로봇 PC**에서만 의미가 있다.