Skip to content

Update README.md #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
235 changes: 58 additions & 177 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,217 +1,98 @@
# :scroll:Loopquest
# 🚀 **Loopquest**

A Production Tool for Embodied AI.
![loopquest demo](screenshots/open_loopquest_demo.gif)
*A Production Tool for Embodied AI.*

- :video_camera:[Quickstart Demo](https://capture.dropbox.com/embed/CpS8Y4g21ClHlief), [Dataset Demo](https://capture.dropbox.com/AOF5rGxHWyRb9T58)
- :house:[Discord](https://discord.gg/FTnFYeSy9r)
![Loopquest Demo](screenshots/open_loopquest_demo.gif)

# Major features
---

- Imitation Learning / Offline Reinforcement Learning Oriented MLOps. Log all the observation, action, reward, rendered images into database with only ONE extra line of code.

```python
env = gymnasium.make("MountainCarContinuous-v0", render_mode="rgb_array")
```

->

```python
import loopquest
loopquest.init()
env = loopquest.make_env(
"MountainCarContinuous-v0", render_mode="rgb_array")
)
```

- You can also evaluate the local policy or the policy saved in Huggingface directly by specifying number of episodes and number of steps for each episode.

Local Policy evaluation:

```python
import loopquest
from loopquest.eval import evaluate_local_policy
from loopquest.policy.base import BasePolicy

class RandomPolicy(BasePolicy):
def __init__(self, action_space):
self.action_space = action_space

def compute_action(self, observation):
return self.action_space.sample()
## 📌 **Major Features**


policy = RandomPolicy(env.action_space)

evaluate_local_policy(
policy,
[
"FetchPickAndPlace-v2",
"FetchPushDense-v2",
"FetchReachDense-v2",
"FetchSlideDense-v2",
],
num_episodes=1,
num_steps_per_episode=100,
project_name="test_robotics",
)
```

Remote Policy evaluation:
✔️ **Imitation Learning & Offline Reinforcement Learning MLOps**
- Log observation, action, reward, and rendered images with **just one extra line of code**.

```python
import loopquest
from loopquest.eval import evaluate_local_policy, evaluate_remote_policy

loopquest.init()

# Cloud evaluation example
evaluate_remote_policy(
"jxx123/ppo-LunarLander-v2",
"ppo-LunarLander-v2.zip",
"PPO",
["LunarLander-v2"],
num_episodes=1,
num_steps_per_episode=100,
project_name="test_lunar_remote",
experiment_configs={"foo": [1, 2, 3], "bar": "hah", "bar": 1.1},
)

```

- Directly trainable data for robotics foundation model. Select and download the (observation, action, reward) data with the dataloader interfaces of the most popular deep learning frameworks (e.g. tensorflow, pytorch, huggingface dataset apis). Check [Dataset Quickstart Example](examples/Dataset%20Quickstart.ipynb) for more details.

```python
from loopquest.datasets import load_dataset, load_datasets
# Load data from a single experiment
ds = load_dataset("your_experiment_id")

# Load data from multiple experiments
ds = load_datasets(["exp1", "exp2"])
```

The data schema will look like

```python
{
'id': '34yixvic-0-1',
'creation_time': '2023-09-03T20:53:30.603',
'update_time': '2023-09-03T20:53:30.965',
'experiment_id': '34yixvic',
'episode': 0,
'step': 1,
'observation': [-0.55, 0.00],
'action': [0.14],
'reward': -0.00,
'prev_observation': [-0.55, 0.00],
'termnated': False,
'truncated': False,
'done': False,
'info': '{}',
'sub_goal': None,
'image_ids': ['34yixvic-0-1-0'],
'images': [<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=600x400 at 0x7F8D33094450>]
}
env = loopquest.make_env("MountainCarContinuous-v0", render_mode="rgb_array")
```

- All the regular MLOps features are included, e.g. data visualization, simulation rendering, experiment management.

# Installation

For stable version, run

```
✔️ **Evaluate Local & Remote Policies**
- **Local Policy Evaluation**
```python
from loopquest.eval import evaluate_local_policy
evaluate_local_policy(policy, ["FetchPickAndPlace-v2"], num_episodes=1)
```

- **Remote Policy Evaluation**
```python
from loopquest.eval import evaluate_remote_policy
evaluate_remote_policy("jxx123/ppo-LunarLander-v2", "ppo-LunarLander-v2.zip", "PPO", ["LunarLander-v2"], num_episodes=1)
```

✔️ **Trainable Data for Robotics Foundation Models**
- Easily download structured datasets with **TensorFlow, PyTorch, or Hugging Face APIs**.
```python
from loopquest.datasets import load_dataset
ds = load_dataset("your_experiment_id")
```

✔️ **Complete MLOps Features**
- **Data visualization**, **simulation rendering**, and **experiment management**.

---

## ⚡ **Installation**

For the stable version:
```bash
pip install loopquest
```

For dev version or loopquest project contributors, clone the git to your local machine by running

```
For development or contributions:
```bash
git clone https://github.com/LoopMind-AI/loopquest.git
```

Change to the project root folder and install the package

```
cd loopquest
pip install -e .
```

# Quick Start Examples
---

## Run Local or Remote Eval

Run [examples/run_local_eval.py](examples/run_local_eval.py).
## 🎯 **Quick Start Examples**

🔹 **Run Local Evaluation**
```python
import loopquest
from loopquest.eval import evaluate_local_policy
from loopquest.policy.base import BasePolicy
import gymnasium as gym


class RandomPolicy(BasePolicy):
def __init__(self, action_space):
self.action_space = action_space

def compute_action(self, observation):
return self.action_space.sample()


# Create this env just to get the action space.
env = gym.make("FetchPickAndPlace-v2")
policy = RandomPolicy(env.action_space)

loopquest.init()
evaluate_local_policy(
policy,
[
"FetchPickAndPlace-v2",
"FetchPushDense-v2",
"FetchReachDense-v2",
"FetchSlideDense-v2",
],
num_episodes=1,
num_steps_per_episode=100,
project_name="test_robotics_new",
)
evaluate_local_policy(policy, ["FetchPickAndPlace-v2"], num_episodes=1)
```

Run [examples/run_remote_eval.py](examples/run_remote_eval.py).

🔹 **Run Remote Evaluation**
```python
import loopquest
from loopquest.eval import evaluate_remote_policy


loopquest.init()
evaluate_remote_policy(
"jxx123/ppo-LunarLander-v2",
"ppo-LunarLander-v2.zip",
"PPO",
["LunarLander-v2"],
num_episodes=1,
num_steps_per_episode=100,
project_name="test_lunar_remote",
experiment_configs={"foo": [1, 2, 3], "bar": "hah", "bar": 1.1},
)
evaluate_remote_policy("jxx123/ppo-LunarLander-v2", "ppo-LunarLander-v2.zip", "PPO", ["LunarLander-v2"], num_episodes=1)
```

## Env Wrapper Example

Run [examples/run_env_wrapper.py](examples/run_env_wrapper.py).

🔹 **Environment Wrapper Example**
```python
import loopquest

loopquest.init()
env = loopquest.make_env("MountainCarContinuous-v0", render_mode="rgb_array")
obs, info = env.reset()
for i in range(100):
for _ in range(100):
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
rgb_array = env.render()
if terminated or truncated:
break
env.close()
```

---

## 🌎 **Community & Support**

💬 **Join Our Discord:** [Click Here](https://discord.gg/FTnFYeSy9r) 🏡
🎥 **Watch Quickstart Demos:** [Demo 1](https://capture.dropbox.com/embed/CpS8Y4g21ClHlief) | [Demo 2](https://capture.dropbox.com/AOF5rGxHWyRb9T58)

---

💡 *Loopquest is designed to simplify AI-driven robotics. Give it a try and start building today!* ✨