nemo_rl.environments.nemo_gym_video#
Module Contents#
Functions#
Return a string media source from a Responses/Chat content part. |
|
Resolve a local video source and reject unsupported remote schemes. |
|
Convert bare local video paths to file URLs before Gym dispatch. |
|
Convert one-video Responses input into HF multimodal chat messages. |
|
Replace cached image parts with one lossless native-video manifest. |
|
Preprocess static Gym video with vLLM-equivalent frame sampling. |
Data#
API#
- nemo_rl.environments.nemo_gym_video._VideoConfigValue#
‘TypeVar(…)’
- nemo_rl.environments.nemo_gym_video._LOCAL_VIDEO_METADATA_KEYS#
‘frozenset(…)’
- nemo_rl.environments.nemo_gym_video._require_video_config_value(
- value: nemo_rl.environments.nemo_gym_video._VideoConfigValue | None,
- field_name: str,
- nemo_rl.environments.nemo_gym_video._get_content_part_url(part: dict[str, Any], *keys: str) str#
Return a string media source from a Responses/Chat content part.
- nemo_rl.environments.nemo_gym_video._resolve_local_video_path(source: str) str#
Resolve a local video source and reject unsupported remote schemes.
- nemo_rl.environments.nemo_gym_video.normalize_video_urls_in_examples(
- examples: list[dict[str, Any]],
Convert bare local video paths to file URLs before Gym dispatch.
- nemo_rl.environments.nemo_gym_video._extract_static_video_messages(
- nemo_gym_example: dict[str, Any],
Convert one-video Responses input into HF multimodal chat messages.
A video may be represented either by one native video content part or by a sequence of cached
input_imageparts carrying_is_video_frame. The latter is the on-disk frame-cache format used by the video Gym recipes.
- nemo_rl.environments.nemo_gym_video._json_mapping(
- value: Any,
- *,
- field_name: str,
- nemo_rl.environments.nemo_gym_video._metadata_extra_body(
- nemo_gym_example: dict[str, Any],
- nemo_rl.environments.nemo_gym_video._chat_template_kwargs_for_processor(
- nemo_gym_example: dict[str, Any],
- nemo_rl.environments.nemo_gym_video._deep_merge_dict(
- base: dict[str, Any],
- update: dict[str, Any],
- nemo_rl.environments.nemo_gym_video._inject_vllm_mm_processor_kwargs(
- nemo_gym_example: dict[str, Any],
- mm_processor_kwargs: dict[str, Any],
- nemo_rl.environments.nemo_gym_video._remove_vllm_mm_processor_kwargs(
- nemo_gym_example: dict[str, Any],
- names: set[str],
- nemo_rl.environments.nemo_gym_video._replace_cached_video_frames_with_native_video(
- nemo_gym_example: dict[str, Any],
Replace cached image parts with one lossless native-video manifest.
- nemo_rl.environments.nemo_gym_video._strip_local_media_metadata(
- nemo_gym_example: dict[str, Any],
- nemo_rl.environments.nemo_gym_video._compute_dynamic_prompt_length(
- processor: Any,
- messages: list[dict[str, Any]],
- template_kwargs: dict[str, Any],
- nemo_rl.environments.nemo_gym_video._video_to_image_content(
- video_path: str,
- *,
- num_frames: int,
- temporal_patch_size: int,
- sampling_style: nemo_rl.models.generation.vllm.video_utils.VideoSamplingStyle,
- nemo_rl.environments.nemo_gym_video._make_overlength_filtered_video_example(
- nemo_gym_example: dict[str, Any],
- nemo_rl.environments.nemo_gym_video.nemo_gym_example_to_video_datum_spec(
- nemo_gym_example: dict[str, Any],
- *,
- processor: Any,
- max_seq_length: int | None,
- idx: int,
- task_name: str,
- data_config: nemo_rl.data.interfaces.TaskDataSpec | None = None,
Preprocess static Gym video with vLLM-equivalent frame sampling.
The raw video remains in the outbound Gym request. Cached frames are sent as one native-video manifest so vLLM consumes the same lossless RGB frames as policy preprocessing. Those tensors are reattached to vLLM-authored prompt token IDs after the rollout.