cyclo_intelligence ํŒจ์น˜ โ€” Diffusion / VQ-BeT ์ •์ฑ…์ด ์•ˆ ๋Œ์•„๊ฐ€๋Š” ๋ฌธ์ œ

ROBOTIS cyclo_intelligence ์—์„œ DiffusionยทVQ-BeT ์ •์ฑ…์„ ๋ฐฐํฌํ•˜๋ฉด ๋กœ๋ด‡์ด ์›€์ง์ด์ง€ ์•Š๋Š”๋‹ค. ACT๋Š” ์ •์ƒ ๋™์ž‘ํ•œ๋‹ค. ๊ทธ ์›์ธ๊ณผ ์ˆ˜์ •๋ณธ์ด๋‹ค.

๊ธฐ์ค€ ์ปค๋ฐ‹: 8065dfc (2026-07-10, ROBOTIS-GIT/cyclo_intelligence main)


ํ•œ ์ค„ ์ ์šฉ

curl -fsSL https://huggingface.co/JSHNSL/cyclo-intelligence-patches/resolve/main/apply_patches.sh | bash

VQ-BeT๊นŒ์ง€ ์“ฐ๋ ค๋ฉด (์›น UI ์žฌ๋นŒ๋“œ ํฌํ•จ):

curl -fsSL https://huggingface.co/JSHNSL/cyclo-intelligence-patches/resolve/main/apply_patches.sh | WITH_UI=yes bash

cyclo_intelligence ๊ฐ€ ~/cyclo_intelligence ๊ฐ€ ์•„๋‹ˆ๋ฉด: CYCLO_INTELLIGENCE_DIR=/๊ฒฝ๋กœ bash apply_patches.sh ์Šคํฌ๋ฆฝํŠธ๋Š” ๋ฐฑ์—…(*.bak)์„ ๋งŒ๋“ค๊ณ , ์ด๋ฏธ ์ ์šฉ๋์œผ๋ฉด ๊ฑด๋„ˆ๋›ด๋‹ค.


๋ฌด์—‡์ด ๋ฌธ์ œ์˜€๋‚˜

โ‘  ์—”์ง„์ด ํ ๊ธฐ๋ฐ˜ ์ •์ฑ…์„ ์ง์ ‘ ํ˜ธ์ถœํ•œ๋‹ค (ํ•ต์‹ฌ)

lerobot_engine/prediction.py ๋Š” ์ •์ฑ… ์ถ”๋ก ์„ ์ด๋ ‡๊ฒŒ ํ•œ๋‹ค:

action = self._policy.predict_action_chunk(batch)      # ์ง์ ‘ ํ˜ธ์ถœ

๊ทธ๋Ÿฐ๋ฐ Diffusion๊ณผ VQ-BeT์˜ predict_action_chunk ๋Š” ๋‹จ๋… ํ˜ธ์ถœ์ด ๋ถˆ๊ฐ€๋Šฅํ•˜๋‹ค. ๋‚ด๋ถ€ observation ํ(self._queues)๋ฅผ stackํ•˜๋Š”๋ฐ, ๊ทธ ํ๋ฅผ ์ฑ„์šฐ๋Š” ๊ฑด select_action ๋ฟ์ด๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค:

# lerobot/policies/diffusion/modeling_diffusion.py
def predict_action_chunk(self, batch, noise=None):
    # stack n latest observations from the queue
    batch = {k: torch.stack(list(self._queues[k]), dim=1) for k in batch if k in self._queues}

ํ๊ฐ€ ๋น„์–ด ์žˆ์œผ๋‹ˆ:

RuntimeError: stack expects a non-empty TensorList

โ†’ get_action ์‹คํŒจ โ†’ ์•ก์…˜์ด ๋ฐœํ–‰๋˜์ง€ ์•Š์Œ โ†’ ๋กœ๋ด‡์ด ์•ˆ ์›€์ง์ธ๋‹ค.

ACT๋Š” n_obs_steps=1 ์ด๋ผ ํ๋ฅผ ์•ˆ ์“ด๋‹ค. ๊ทธ๋ž˜์„œ ACT๋งŒ ๋ฉ€์ฉกํ–ˆ๋˜ ๊ฒƒ์ด๋‹ค.

๊ธฐ์กด fallback์€ except (NotImplementedError, AttributeError) ๋งŒ ์žก์•„์„œ RuntimeError ๋ฅผ ๋ชป ๊ฑธ๋ €๋‹ค.

์ˆ˜์ •: ํ ๊ธฐ๋ฐ˜ ์ •์ฑ…์€ predict_action_chunk ๋ฅผ ์•„์˜ˆ ๊ฑด๋„ˆ๋›ฐ๊ณ  select_action ์œผ๋กœ ๋ผ์šฐํŒ…ํ•œ๋‹ค.

_QUEUE_BASED_POLICIES = {"VQBeTPolicy", "DiffusionPolicy"}

def _predict_chunk(self, batch):
    if type(self._policy).__name__ in self._QUEUE_BASED_POLICIES:
        return self._select_action_chunk(batch)      # ํ๋ฅผ ์ฑ„์šฐ๋Š” ๊ฒฝ๋กœ
    try:
        ...
    except (NotImplementedError, AttributeError, RuntimeError, AssertionError):
        return self._select_action_chunk(batch)      # ์•ˆ์ „๋ง

โ‘ก diffusers ๊ฐ€ ์ถ”๋ก  ์ปจํ…Œ์ด๋„ˆ์— ์—†๋‹ค

Diffusion ์ •์ฑ…์ด ์š”๊ตฌํ•œ๋‹ค. lerobot_server ์ปจํ…Œ์ด๋„ˆ์—” pip ์ด ์—†๊ณ  uv ๋ฅผ ์“ด๋‹ค:

docker exec lerobot_server sh -c 'VIRTUAL_ENV=/lerobot/.venv uv pip install diffusers'

pip install ์€ No module named pip ์œผ๋กœ ์‹คํŒจํ•œ๋‹ค.

โ‘ข ์›น UI ๋“œ๋กญ๋‹ค์šด์— VQ-BeT์ด ์—†๋‹ค (VQ-BeT๋งŒ ํ•ด๋‹น)

๋ฐฑ์—”๋“œ๋Š” vqbet์„ ์ง€์›ํ•˜๋Š”๋ฐ UI ๋ชฉ๋ก์— ํ•ญ๋ชฉ์ด ์—†๋‹ค. ํ•œ ์ค„ ์ถ”๊ฐ€ + ์žฌ๋นŒ๋“œ๊ฐ€ ํ•„์š”ํ•˜๋‹ค.

โš ๏ธ ./docker/container.sh build-ui ๋Š” ์‹คํŒจํ•œ๋‹ค. npm์„ ํ˜ธ์ŠคํŠธ uid๋กœ ๋Œ๋ฆฌ๋Š”๋ฐ UI๊ฐ€ ์ปจํ…Œ์ด๋„ˆ /root/ ๋ฐ‘์ด๋ผ permission denied๊ฐ€ ๋‚˜๊ณ , ๊ทธ๊ฒŒ ์—‰๋šฑํ•˜๊ฒŒ "no lockfile" ์—๋Ÿฌ๋กœ ๋ณด๊ณ ๋œ๋‹ค. root๋กœ ์ง์ ‘ ๋นŒ๋“œํ•ด์•ผ ํ•œ๋‹ค (์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๊ทธ๋ ‡๊ฒŒ ํ•œ๋‹ค).


ํŒŒ์ผ

ํŒŒ์ผ ๋‚ด์šฉ
apply_patches.sh ์ „๋ถ€ ์ ์šฉํ•˜๋Š” ์Šคํฌ๋ฆฝํŠธ
prediction.py ํŒจ์น˜๋œ ์—”์ง„ โ†’ cyclo_brain/policy/lerobot/lerobot_engine/prediction.py
InferenceModelSelector.js VQ-BeT ํ•ญ๋ชฉ ์ถ”๊ฐ€ โ†’ orchestrator/ui/src/components/InferenceModelSelector.js
prediction.diff / ui.diff ์›๋ณธ ๋Œ€๋น„ ๋ณ€๊ฒฝ๋ถ„ (๊ฒ€ํ† ์šฉ)

์ˆ˜๋™ ์ ์šฉ

CI=~/cyclo_intelligence
BASE=https://huggingface.co/JSHNSL/cyclo-intelligence-patches/resolve/main

# โ‘  ์—”์ง„ ํŒจ์น˜
cp "$CI/cyclo_brain/policy/lerobot/lerobot_engine/prediction.py"{,.bak}
curl -fsSL "$BASE/prediction.py" -o "$CI/cyclo_brain/policy/lerobot/lerobot_engine/prediction.py"

# โ‘ก diffusers (Diffusion ์“ธ ๋•Œ๋งŒ)
docker exec lerobot_server sh -c 'VIRTUAL_ENV=/lerobot/.venv uv pip install diffusers'

# โ‘ข ์žฌ์‹œ์ž‘
docker restart lerobot_server

VQ-BeT๋„ ์“ฐ๋ ค๋ฉด ์ถ”๊ฐ€๋กœ:

cp "$CI/orchestrator/ui/src/components/InferenceModelSelector.js"{,.bak}
curl -fsSL "$BASE/InferenceModelSelector.js" -o "$CI/orchestrator/ui/src/components/InferenceModelSelector.js"

CID=$(docker ps -qf name=cyclo_intelligence)
UID_D=/root/ros2_ws/src/cyclo_intelligence/orchestrator/ui
docker exec -w "$UID_D" "$CID" bash -lc "npm ci --legacy-peer-deps"
docker exec -w "$UID_D" "$CID" bash -lc "npm run build"
docker exec "$CID" sh -c "cp -a $UID_D/build/. /usr/share/nginx/html/ && nginx -s reload"
# ๋ธŒ๋ผ์šฐ์ € ๊ฐ•๋ ฅ ์ƒˆ๋กœ๊ณ ์นจ (Ctrl+Shift+R)

ํ™•์ธ

# ์—”์ง„์— ํŒจ์น˜๊ฐ€ ์‚ด์•„์žˆ๋‚˜
docker exec lerobot_server sh -c 'grep -n _QUEUE_BASED_POLICIES /app/lerobot_engine/prediction.py'

# ์ถ”๋ก  ์ค‘ ๋กœ๊ทธ
docker logs -f lerobot_server
  • RuntimeError: stack expects a non-empty TensorList ๊ฐ€ ์•ˆ ๋‚˜์˜ค๋ฉด ์„ฑ๊ณต
  • Action chunk: T=..., D=... ๊ฐ€ ๋ฐ˜๋ณต๋˜๋ฉด ์•ก์…˜์ด ๋‚˜๊ฐ€๋Š” ์ค‘

๋˜๋Œ๋ฆฌ๊ธฐ

mv <ํŒŒ์ผ>.bak <ํŒŒ์ผ>
docker restart lerobot_server

์ฃผ์˜

  • prediction.py ๋Š” ํ˜ธ์ŠคํŠธ ํŒŒ์ผ์ด๊ณ  ์ปจํ…Œ์ด๋„ˆ์—” read-only ๋งˆ์šดํŠธ๋œ๋‹ค โ†’ ํ˜ธ์ŠคํŠธ์—์„œ ๊ณ ์น˜๊ณ  ์žฌ์‹œ์ž‘ํ•ด์•ผ ๋ฐ˜์˜๋œ๋‹ค.
  • diffusers ์„ค์น˜๋Š” ์ปจํ…Œ์ด๋„ˆ์˜ writable layer์— ๋“ค์–ด๊ฐ„๋‹ค. docker restart ๋Š” ์œ ์ง€๋˜์ง€๋งŒ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์žฌ์ƒ์„ฑ(--force-recreate, docker rm)ํ•˜๋ฉด ์‚ฌ๋ผ์ง„๋‹ค โ†’ ๋‹ค์‹œ ์„ค์น˜ํ•ด์•ผ ํ•œ๋‹ค.
  • cyclo_intelligence ๊ฐ€ ์—…๋ฐ์ดํŠธ๋˜๋ฉด prediction.py ๊ฐ€ ๋ฎ์–ด์จ์งˆ ์ˆ˜ ์žˆ๋‹ค โ†’ ๊ทธ๋•Œ ๋‹ค์‹œ ์ ์šฉํ•œ๋‹ค.

๊ด€๋ จ

Downloads last month

-

Downloads are not tracked for this model. How to track
Video Preview
loading