Skip to content

Commit

Permalink
HITL - Add collaboration episode loader. (facebookresearch#1933)
Browse files Browse the repository at this point in the history
* Add collaboration episode loader.

* Remove unused object_goal_pairs.
  • Loading branch information
0mdc authored and dannymcy committed Jun 26, 2024
1 parent 5a636ca commit 2b52501
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions examples/hitl/rearrange_v2/collaboration_episode_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env python3

# Copyright (c) Meta Platforms, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import typing

from habitat.datasets.rearrange.rearrange_dataset import RearrangeEpisode

try:
from habitat_llm.agent.env import dataset # noqa: F401
from habitat_llm.agent.env.dataset import CollaborationEpisode

collaboration_episode_enabled = True
except ImportError:
print("Unable to load CollaborationDataset episode format.")
collaboration_episode_enabled = False


class CollaborationEpisodeData:
instruction: str = ""


if collaboration_episode_enabled:

def load_collaboration_episode_data(
episode: RearrangeEpisode,
) -> CollaborationEpisodeData:
episode_data = CollaborationEpisodeData()

if not isinstance(episode, CollaborationEpisode):
return episode_data

episode = typing.cast(CollaborationEpisode, episode)
episode_data.instruction = episode.instruction

return episode_data

else:

def load_collaboration_episode_data(
episode: RearrangeEpisode,
) -> CollaborationEpisodeData:
return CollaborationEpisodeData()

0 comments on commit 2b52501

Please sign in to comment.