forked from facebookresearch/habitat-lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HITL - Add collaboration episode loader. (facebookresearch#1933)
* Add collaboration episode loader. * Remove unused object_goal_pairs.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
examples/hitl/rearrange_v2/collaboration_episode_loader.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |