Skip to navigation

nemo_gym.sandbox.utils

View as Markdown

Sandbox utility helpers.

Module Contents

Functions

NameDescription
cpu_cap_envCPU_CAP_ENV_VARS derived from a sandbox CPU limit; empty when unset.
read_textDownload UTF-8 text, replacing invalid bytes in partial process output.
rewrite_imageApply ordered image-prefix rewrites used by sandbox configs.
upload_textUpload UTF-8 text through file transfer without shell interpolation.

Data

CPU_CAP_ENV_VARS

API

nemo_gym.sandbox.utils.cpu_cap_env(
cpu: float | int | None
) -> dict[str, str]

CPU_CAP_ENV_VARS derived from a sandbox CPU limit; empty when unset.

nemo_gym.sandbox.utils.read_text(
path: str
) -> str
async

Download UTF-8 text, replacing invalid bytes in partial process output.

nemo_gym.sandbox.rewrite_image(
image: str | None,
rewrites: list[dict[str, str]]
) -> str | None

Apply ordered image-prefix rewrites used by sandbox configs.

nemo_gym.sandbox.utils.upload_text(
path: str,
text: str
) -> None
async

Upload UTF-8 text through file transfer without shell interpolation.

nemo_gym.sandbox.utils.CPU_CAP_ENV_VARS: tuple[str, ...] = ('OMP_NUM_THREADS', 'OMP_THREAD_LIMIT', 'OPENBLAS_NUM_THREADS', 'MKL_NUM_THREADS...