Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 6 additions & 7 deletions cookbook/en/sandbox/training_sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ All Docker images are hosted on Alibaba Cloud Container Registry (ACR) for optim
```

```bash
# Pull and tag Appworld ARM64 architecture image
docker pull agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-appworld:latest-arm64 && docker tag agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-appworld:latest-arm64 agentscope/runtime-sandbox-appworld:latest-arm64
# Pull Appworld image from DockerHub
docker pull agentscope/runtime-sandbox-appworld:latest

# Pull and tag Appworld X86_64 architecture image
# Pull and tag Appworld image from ACR
docker pull agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-appworld:latest && docker tag agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-appworld:latest agentscope/runtime-sandbox-appworld:latest
```

Expand Down Expand Up @@ -190,10 +190,10 @@ All Docker images are hosted on Alibaba Cloud Container Registry (ACR) for optim
```

```bash
# Pull and tag BFCL ARM64 architecture image
docker pull agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-bfcl:latest-arm64 && docker tag agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-bfcl:latest-arm64 agentscope/runtime-sandbox-bfcl:latest-arm64
# Pull BFCL image from DockerHub
docker pull agentscope/runtime-sandbox-bfcl:latest

# Pull and tag BFCL X86 architecture image
# Pull and tag BFCL image from ACR
docker pull agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-bfcl:latest && docker tag agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-bfcl:latest agentscope/runtime-sandbox-bfcl:latest
```

Expand Down Expand Up @@ -301,7 +301,6 @@ for turn_no, msg in enumerate(ASSISTANT_MESSAGES, 1):
```python
score = box.evaluate(inst_id, params={"sparse": True})
print(f"\n[RESULT] sparse_score = {score}")

```
#### Release Instance
```python
Expand Down
17 changes: 6 additions & 11 deletions cookbook/zh/sandbox/training_sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ pip install agentscope-runtime
```

```bash
# 拉取并标记Appworld ARM64架构镜像
docker pull agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-appworld:latest-arm64 && docker tag agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-appworld:latest-arm64 agentscope/runtime-sandbox-appworld:latest-arm64
# 从 DockerHub 拉取 Appworld 镜像
docker pull agentscope/runtime-sandbox-appworld:latest

# 拉取并标记 Appworld X86_64 架构镜像
# 从 ACR 拉取 Appworld 镜像并打标签
docker pull agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-appworld:latest && docker tag agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-appworld:latest agentscope/runtime-sandbox-appworld:latest
```

Expand Down Expand Up @@ -109,8 +109,6 @@ print(profile_list[0])

```python


profile_list = box.get_env_profile(env_type="appworld", split="train")
init_response = box.create_instance(
env_type="appworld",
Expand All @@ -119,8 +117,6 @@ init_response = box.create_instance(
instance_id = init_response["info"]["instance_id"]
query = init_response["state"]
print(f"Created instance {instance_id} with query: {query}")


```

#### 使用训练样本
Expand All @@ -139,7 +135,6 @@ result = box.step(
action=action,
)
print(result)

```

#### 评测训练样本
Expand Down Expand Up @@ -173,10 +168,10 @@ print(f"Instance released: {success}")
```

```bash
# 拉取并标记BFCL ARM64架构镜像
docker pull agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-bfcl:latest-arm64 && docker tag agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-bfcl:latest-arm64 agentscope/runtime-sandbox-bfcl:latest-arm64
# 从 DockerHub 拉取 BFCL 镜像
docker pull agentscope/runtime-sandbox-bfcl:latest

# 拉取并标记 BFCL X86_64 架构镜像
# 从 ACR 拉取 BFCL 镜像并打标签
docker pull agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-bfcl:latest && docker tag agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-bfcl:latest agentscope/runtime-sandbox-bfcl:latest
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def release_instance(self, instance_id: str):


@SandboxRegistry.register(
build_image_uri("runtime-sandbox-appworld", arm64_compatible=False),
build_image_uri("runtime-sandbox-appworld"),
sandbox_type=SandboxType.APPWORLD,
runtime_config={"shm_size": "5.06gb"},
security_level="medium",
Expand Down Expand Up @@ -251,7 +251,7 @@ def __init__(


@SandboxRegistry.register(
build_image_uri("runtime-sandbox-bfcl", arm64_compatible=False),
build_image_uri("runtime-sandbox-bfcl"),
sandbox_type=SandboxType.BFCL,
runtime_config={"shm_size": "8.06gb"},
security_level="medium",
Expand Down
18 changes: 0 additions & 18 deletions src/agentscope_runtime/sandbox/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def build_image_uri(
tag: str = None,
registry: str = None,
namespace: str = None,
arm64_compatible: bool = True,
) -> str:
"""
Build a fully qualified Docker image URI.
Expand All @@ -30,12 +29,6 @@ def build_image_uri(
If empty or whitespace, registry prefix will be omitted.
namespace : str, optional
Docker image namespace. Defaults to the global ``IMAGE_NAMESPACE``.
arm64_compatible : bool, optional
Whether the image is ARM64-compatible without special tagging.
If ``True`` (default), the tag is returned unchanged.
If ``False``, the function will detect the current machine
architecture and append ``-arm64`` to the tag if running on ARM64 (
e.g., ``arm64``, ``aarch64``).

Returns
-------
Expand All @@ -55,24 +48,13 @@ def build_image_uri(
>>> build_image_uri("runtime-sandbox-base", registry="")
'agentscope/runtime-sandbox-base:latest'

>>> build_image_uri("runtime-sandbox-base", arm64_compatible=False)
'agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime
-sandbox-base:latest-arm64'
# (Above example assumes running on ARM64 machine)
"""
reg = registry if registry is not None else REGISTRY
reg = "" if reg.strip() == "" else f"{reg.strip()}/"

final_namespace = namespace if namespace is not None else IMAGE_NAMESPACE
final_tag = tag or IMAGE_TAG

# TODO: make manifest compatible and remove this
# Adjust tag based on ARM64 compatibility
if not arm64_compatible:
machine = platform.machine().lower()
if "arm" in machine or "aarch64" in machine:
final_tag = f"{final_tag}-arm64"

return f"{reg}{final_namespace}/{image_name}:{final_tag}"


Expand Down
Loading