Views
No views yet

1# ===== system2 demo =====
2from InternVLA.model.framework.M1 import InternVLA_M1
3from PIL import Image
4import requests
5from io import BytesIO
6
7def load_image_from_url(url: str) -> Image.Image:
8 resp = requests.get(url, timeout=15)
9 resp.raise_for_status()
10 img = Image.open(BytesIO(resp.content)).convert("RGB")
11 return img
12
13
14saved_model_path = "/PATH//checkpoints/steps_50000_pytorch_model.pt"
15internVLA_M1 = InternVLA_M1.from_pretrained(
16 saved_model_path
17)
18
19image_url="https://github.com/InternRobotics/InternVLA-M1/blob/InternVLA-M1/assets/table.jpeg"
20image = load_image_from_url(image_url)
21question = "give the bbox for the apple."
22response = internVLA_M1.chat_with_M1(image, question)
23
24# ===== predict_action demo =====
25# constuct input: batch size = 1, two views
26view1 = load_image_from_url(image_url)
27view2 = view1.copy()
28batch_images = [[view1]] # List[List[PIL.Image]]
29instructions = ["pick up the apple and place it on the plate."]
30
31if torch.cuda.is_available():
32 internVLA_M1 = internVLA_M1.to("cuda")
33
34# action predict
35pred = internVLA_M1.predict_action(
36 batch_images=batch_images,
37 instructions=instructions,
38 cfg_scale=1.5,
39 use_ddim=True,
40 num_ddim_steps=10,
41)
42normalized_actions = pred["normalized_actions"] # [B, T, action_dim]@misc{internvla2024,
title = {InternVLA-M1: A Spatially Guided Vision-Language-Action Framework for Generalist Robot Policy},
author = {InternVLA-M1 Contributors},
year = {2025},
booktitle={arXiv},
}