Skip to content

feat: real-world discriminator fine-tuning pipeline (closes #29)#56

Open
Aaryaman3 wants to merge 2 commits intoNVlabs:mainfrom
Aaryaman3:real-world-finetune
Open

feat: real-world discriminator fine-tuning pipeline (closes #29)#56
Aaryaman3 wants to merge 2 commits intoNVlabs:mainfrom
Aaryaman3:real-world-finetune

Conversation

@Aaryaman3
Copy link

Summary

Adds infrastructure for fine-tuning the GraspGen discriminator on real-world robot rollout data (closes #29).

New files

  • scripts/record_grasp.pyGraspRecorder: records grasp attempts (pose, point cloud, confidence, success/fail, collision) to rollouts.h5 + grasps.json. Also writes directly to GraspGenDatasetCache HDF5 via write_cache().
  • scripts/prepare_finetune.py — CLI: validates rollout data, builds the training cache, prints the exact train_graspgen.py command to run.
  • tests/test_record_grasp.py — 20 unit tests: save/load, label correctness, from_h5() round-trip, multi-object cache writes, config key validation.
  • scripts/test_training_step.py — integration tests for a real discriminator training step (with and without mesh) on the GCP VM.

Bug fixes in dataset.py

  • Numpy→tensor guard for preloaded point clouds (was crashing with preload_dataset=True)
  • Meshless guard in load_discriminator_batch_with_stratified_sampling when no .obj file exists

These two were breaking real-world use no matter what else you did right.

Validated on GCP VM

Discriminator pos/neg gap: -0.0012 → +0.0155 after 50 fine-tune steps on trimesh-labeled banana grasps.

Not covered

  • Coordinate frame correctness needs a real robot to verify assumes caller passes point clouds and poses in the object-centered frame GraspGen expects. @adithyamurali let me know if the transform chain is wrong.
  • Whether this actually improves grasp success rate needs a robot experiment.
  • discriminator_ratio must be 7-element with on-policy data (documented in record_grasp.py header).

Test plan

  • pytest tests/test_record_grasp.py — all 20 pass
  • python scripts/test_training_step.pyrun() and run_meshless() both pass on the VM
  • python scripts/prepare_finetune.py --help — args parse correctly

- GraspRecorder: records grasp attempts (pose, point cloud, confidence,
  success, collision) to rollouts.h5 + grasps.json
- write_cache(): converts recordings to GraspGenDatasetCache HDF5 format
  for preload_dataset=True training; appends to file instead of clobbering
- from_h5(): reconstructs GraspRecorder from saved files (used by prepare_finetune.py)
- prepare_finetune.py: user-facing script that validates rollout data,
  builds the training cache, and prints the exact fine-tune command
- 20 unit tests covering save/load, labels, round-trip, multi-object cache,
  and config key validation
- dataset.py fixes: numpy→tensor guard for preloaded point clouds,
  meshless guard when no .obj file exists

Fine-tuning signal validated on GCP VM: discriminator pos/neg gap increased
from -0.0012 → +0.0155 after 50 steps on trimesh-labeled banana grasps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inquiry on Real Data Inference & Fine-Tuning Release Timeline

1 participant