diff --git a/.gitignore b/.gitignore index 66c046a0b5..88de384705 100644 --- a/.gitignore +++ b/.gitignore @@ -217,4 +217,5 @@ inference_testing *.rrd openspec*/ -opsx/ \ No newline at end of file +opsx/ +checkpoints/ diff --git a/docker/dockerfiles/Dockerfile.onnx.gpu b/docker/dockerfiles/Dockerfile.onnx.gpu index 33969fbb8a..58f925da47 100644 --- a/docker/dockerfiles/Dockerfile.onnx.gpu +++ b/docker/dockerfiles/Dockerfile.onnx.gpu @@ -108,6 +108,10 @@ RUN ln -s /usr/bin/python3 /usr/bin/python RUN /bin/make create_wheels_for_gpu_notebook RUN pip3 install --no-cache-dir dist/inference_cli*.whl dist/inference_core*.whl dist/inference_gpu*.whl dist/inference_sdk*.whl "setuptools<=75.5.0" +# Instal Cosmos 3 preview (requires override of transformers, since 21.07.2026 it was not released yet). +COPY requirements/requirements.cosmos.txt . +RUN python3 -m pip install -r requirements.cosmos.txt + WORKDIR /notebooks COPY examples/notebooks . diff --git a/inference/core/env.py b/inference/core/env.py index 7d8b1ed404..445eb12af8 100644 --- a/inference/core/env.py +++ b/inference/core/env.py @@ -259,6 +259,8 @@ LMM_ENABLED = str2bool(os.getenv("LMM_ENABLED", False)) +COSMOS3_ENABLED = str2bool(os.getenv("COSMOS3_ENABLED", True)) + QWEN_2_5_ENABLED = str2bool(os.getenv("QWEN_2_5_ENABLED", True)) QWEN_3_ENABLED = str2bool(os.getenv("QWEN_3_ENABLED", True)) diff --git a/inference/core/workflows/core_steps/loader.py b/inference/core/workflows/core_steps/loader.py index f6d6df010c..9675f575c1 100644 --- a/inference/core/workflows/core_steps/loader.py +++ b/inference/core/workflows/core_steps/loader.py @@ -238,6 +238,9 @@ from inference.core.workflows.core_steps.models.foundation.cog_vlm.v1 import ( CogVLMBlockV1, ) +from inference.core.workflows.core_steps.models.foundation.cosmos3.v1 import ( + Cosmos3EdgeBlockV1, +) from inference.core.workflows.core_steps.models.foundation.depth_estimation.v1 import ( DepthEstimationBlockV1, ) @@ -1009,6 +1012,7 @@ def load_blocks() -> List[Type[WorkflowBlock]]: GoogleGemmaBlockV1, GoogleGemmaBlockV2, ImageSlicerBlockV2, + Cosmos3EdgeBlockV1, Qwen25VLBlockV1, Qwen3VLBlockV1, Qwen35VLBlockV1, diff --git a/inference/core/workflows/core_steps/models/foundation/cosmos3/__init__.py b/inference/core/workflows/core_steps/models/foundation/cosmos3/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/inference/core/workflows/core_steps/models/foundation/cosmos3/v1.py b/inference/core/workflows/core_steps/models/foundation/cosmos3/v1.py new file mode 100644 index 0000000000..f46d939ce1 --- /dev/null +++ b/inference/core/workflows/core_steps/models/foundation/cosmos3/v1.py @@ -0,0 +1,254 @@ +from typing import List, Literal, Optional, Type, Union + +from pydantic import ConfigDict, Field + +from inference.core.entities.requests.inference import LMMInferenceRequest +from inference.core.env import ( + COSMOS3_ENABLED, + HOSTED_CORE_MODEL_URL, + LOCAL_INFERENCE_API_URL, + WORKFLOWS_REMOTE_API_TARGET, +) +from inference.core.managers.base import ModelManager +from inference.core.workflows.core_steps.common.entities import StepExecutionMode +from inference.core.workflows.execution_engine.entities.base import ( + Batch, + OutputDefinition, + WorkflowImageData, +) +from inference.core.workflows.execution_engine.entities.types import ( + IMAGE_KIND, + LANGUAGE_MODEL_OUTPUT_KIND, + ROBOFLOW_MODEL_ID_KIND, + STRING_KIND, + ImageInputField, + Selector, +) +from inference.core.workflows.prototypes.block import ( + BlockResult, + Runtime, + RuntimeRestriction, + Severity, + WorkflowBlock, + WorkflowBlockManifest, +) +from inference_sdk import InferenceHTTPClient + +DEFAULT_PROMPT = "Describe what's in this image." +DEFAULT_SYSTEM_PROMPT = ( + "You are Cosmos, a helpful assistant that understands physical scenes " + "and answers questions about images and videos." +) + + +class BlockManifest(WorkflowBlockManifest): + model_config = ConfigDict( + json_schema_extra={ + "name": "Cosmos 3", + "version": "v1", + "short_description": "Reason about physical scenes with NVIDIA Cosmos 3.", + "long_description": ( + "This workflow block runs the NVIDIA Cosmos 3 reasoner โ€” a world model " + "tuned for physical scene understandingโ€”on an image with an optional text " + "prompt, and returns a text answer. The model is well suited to questions " + "about spatial relations, safety, and what will happen next in a scene." + ), + "license": "OpenMDW-1.1", + "block_type": "model", + "search_keywords": [ + "Cosmos", + "cosmos3", + "NVIDIA", + "world model", + "vision language model", + "VLM", + "robotics", + ], + "is_vlm_block": True, + "ui_manifest": { + "section": "model", + "icon": "fal fa-atom", + "blockPriority": 5.5, + }, + }, + protected_namespaces=(), + ) + type: Literal["roboflow_core/cosmos3_edge@v1"] + + images: Selector(kind=[IMAGE_KIND]) = ImageInputField + prompt: Optional[Union[Selector(kind=[STRING_KIND]), str]] = Field( + default=None, + description="Optional text prompt to pass to Cosmos 3 Edge. Otherwise a default " + "scene-description prompt is used, which may affect the desired model behavior.", + examples=["Is the walkway free of obstacles?", "$inputs.prompt"], + ) + model_version: Union[ + Selector(kind=[ROBOFLOW_MODEL_ID_KIND]), Literal["nvidia/cosmos-3-edge"] + ] = Field( + default="nvidia/cosmos-3-edge", + description="The Cosmos 3 Edge model to be used for inference.", + examples=["nvidia/cosmos-3-edge"], + ) + system_prompt: Optional[Union[Selector(kind=[STRING_KIND]), str]] = Field( + default=None, + description="Optional system prompt to provide additional context to Cosmos 3 Edge.", + examples=["You are a safety inspector.", "$inputs.system_prompt"], + ) + + @classmethod + def describe_outputs(cls) -> List[OutputDefinition]: + return [ + OutputDefinition( + name="output", + kind=[STRING_KIND, LANGUAGE_MODEL_OUTPUT_KIND], + description="The model's text answer for each input image.", + ), + ] + + @classmethod + def get_parameters_accepting_batches(cls) -> List[str]: + return ["images"] + + @classmethod + def get_execution_engine_compatibility(cls) -> Optional[str]: + return ">=1.3.0,<2.0.0" + + @classmethod + def get_restrictions(cls) -> List[RuntimeRestriction]: + restrictions = [ + RuntimeRestriction( + severity=Severity.HARD, + note="Requires a GPU; run_locally() loads a model that needs CUDA.", + applies_to_runtimes=[Runtime.SELF_HOSTED_CPU], + applies_to_step_execution_modes=[StepExecutionMode.LOCAL], + ), + ] + if not COSMOS3_ENABLED: + restrictions.append( + RuntimeRestriction( + severity=Severity.HARD, + note=( + "COSMOS3_ENABLED=False: the Cosmos 3 Edge endpoint is not " + "registered, so run_remotely() returns 404." + ), + applies_to_runtimes=[Runtime.HOSTED_SERVERLESS], + applies_to_step_execution_modes=[StepExecutionMode.REMOTE], + ) + ) + return restrictions + + @classmethod + def get_supported_model_variants(cls) -> Optional[List[str]]: + """Return list of model_id variants that can satisfy this block.""" + return ["nvidia/cosmos-3-edge"] + + +class Cosmos3EdgeBlockV1(WorkflowBlock): + def __init__( + self, + model_manager: ModelManager, + api_key: Optional[str], + step_execution_mode: StepExecutionMode, + ): + self._model_manager = model_manager + self._api_key = api_key + self._step_execution_mode = step_execution_mode + + @classmethod + def get_init_parameters(cls) -> List[str]: + return ["model_manager", "api_key", "step_execution_mode"] + + @classmethod + def get_manifest(cls) -> Type[WorkflowBlockManifest]: + return BlockManifest + + def run( + self, + images: Batch[WorkflowImageData], + model_version: str, + prompt: Optional[str], + system_prompt: Optional[str], + ) -> BlockResult: + if self._step_execution_mode == StepExecutionMode.LOCAL: + return self.run_locally( + images=images, + model_version=model_version, + prompt=prompt, + system_prompt=system_prompt, + ) + elif self._step_execution_mode == StepExecutionMode.REMOTE: + return self.run_remotely( + images=images, + model_version=model_version, + prompt=prompt, + system_prompt=system_prompt, + ) + else: + raise ValueError( + f"Unknown step execution mode: {self._step_execution_mode}" + ) + + def run_remotely( + self, + images: Batch[WorkflowImageData], + model_version: str, + prompt: Optional[str], + system_prompt: Optional[str], + ) -> BlockResult: + api_url = ( + LOCAL_INFERENCE_API_URL + if WORKFLOWS_REMOTE_API_TARGET != "hosted" + else HOSTED_CORE_MODEL_URL + ) + client = InferenceHTTPClient( + api_url=api_url, + api_key=self._api_key, + ) + if WORKFLOWS_REMOTE_API_TARGET == "hosted": + client.select_api_v0() + + combined_prompt = _combine_prompt(prompt=prompt, system_prompt=system_prompt) + predictions = [] + for image in images: + result = client.infer_lmm( + inference_input=image.base64_image, + model_id=model_version, + prompt=combined_prompt, + model_id_in_path=True, + ) + predictions.append({"output": result.get("response", result)}) + return predictions + + def run_locally( + self, + images: Batch[WorkflowImageData], + model_version: str, + prompt: Optional[str], + system_prompt: Optional[str], + ) -> BlockResult: + inference_images = [ + i.to_inference_format(numpy_preferred=False) for i in images + ] + combined_prompt = _combine_prompt(prompt=prompt, system_prompt=system_prompt) + self._model_manager.add_model(model_id=model_version, api_key=self._api_key) + + predictions = [] + for image in inference_images: + request = LMMInferenceRequest( + api_key=self._api_key, + model_id=model_version, + image=image, + source="workflow-execution", + prompt=combined_prompt, + ) + prediction = self._model_manager.infer_from_request_sync( + model_id=model_version, request=request + ) + predictions.append({"output": prediction.response}) + return predictions + + +def _combine_prompt(prompt: Optional[str], system_prompt: Optional[str]) -> str: + prompt = prompt or DEFAULT_PROMPT + system_prompt = system_prompt or DEFAULT_SYSTEM_PROMPT + return prompt + "" + system_prompt diff --git a/inference/models/README.md b/inference/models/README.md index f1fff8821f..aff5662266 100644 --- a/inference/models/README.md +++ b/inference/models/README.md @@ -3,6 +3,7 @@ The models supported by Roboflow Inference have their own licenses. View the lic | model | license | commercial license available | |:--------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------------------------:| | `inference/models/clip` | [MIT](https://github.com/openai/CLIP/blob/main/LICENSE) | ๐Ÿ‘ | +| `inference/models/cosmos3` | [OpenMDW-1.1](https://openmdw.ai/license/1-1/) | ๐Ÿ‘ | | `inference/models/doctr` | [Apache 2.0](https://github.com/mindee/doctr/blob/main/LICENSE) | ๐Ÿ‘ | | `inference/models/depth_anything_v2` | [Apache 2.0](https://github.com/DepthAnything/Depth-Anything-V2/blob/main/LICENSE) | ๐Ÿ‘ | | `inference/models/depth_anything_v3` | [Apache 2.0](https://github.com/ByteDance-Seed/depth-anything-3/blob/main/LICENSE) | ๐Ÿ‘ | diff --git a/inference/models/cosmos3/LICENSE.txt b/inference/models/cosmos3/LICENSE.txt new file mode 100644 index 0000000000..52f32cc9c1 --- /dev/null +++ b/inference/models/cosmos3/LICENSE.txt @@ -0,0 +1,55 @@ +NVIDIA Cosmos 3 Edge is released under the OpenMDW License Agreement, +version 1.1 (OpenMDW-1.1): https://openmdw.ai/license/1-1/ + +---------------------------------------------------------------------- + +OpenMDW License Agreement, version 1.1 (OpenMDW-1.1) + +By exercising rights granted to you under this agreement, you accept and +agree to its terms. + +As used in this agreement, "Model Materials" means the materials provided +to you under this agreement, consisting of: (1) one or more machine +learning models (including architecture and parameters); and (2) all +related artifacts (including associated data, documentation and software) +that are provided to you hereunder. + +Subject to your compliance with this agreement, permission is hereby +granted, free of charge, to deal in the Model Materials without +restriction, including under all copyright, patent, database, and trade +secret rights included or embodied therein. + +If you distribute any portion of the Model Materials, you shall retain in +your distribution (1) a copy of this agreement, and (2) all copyright +notices and other notices of origin included in the Model Materials that +are applicable to your distribution. + +If you file, maintain, or voluntarily participate in a lawsuit against +any person or entity asserting that the Model Materials directly or +indirectly infringe any patent or copyright, then all rights and grants +made to you hereunder are terminated, unless that lawsuit was in response +to a corresponding lawsuit first brought against you. + +This agreement does not impose any restrictions or obligations with +respect to any use, modification, or sharing of any outputs generated by +using the Model Materials. + +THE MODEL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NONINFRINGEMENT, +ACCURACY, OR THE ABSENCE OF LATENT OR OTHER DEFECTS OR ERRORS, WHETHER OR +NOT DISCOVERABLE, ALL TO THE GREATEST EXTENT PERMISSIBLE UNDER APPLICABLE +LAW. + +YOU ARE SOLELY RESPONSIBLE FOR (1) CLEARING RIGHTS OF OTHER PERSONS THAT +MAY APPLY TO THE MODEL MATERIALS OR ANY USE THEREOF, INCLUDING WITHOUT +LIMITATION ANY PERSON'S COPYRIGHTS OR OTHER RIGHTS INCLUDED OR EMBODIED IN +THE MODEL MATERIALS; (2) OBTAINING ANY NECESSARY CONSENTS, PERMISSIONS OR +OTHER RIGHTS REQUIRED FOR ANY USE OF THE MODEL MATERIALS; OR (3) +PERFORMING ANY DUE DILIGENCE OR UNDERTAKING ANY OTHER INVESTIGATIONS INTO +THE MODEL MATERIALS OR ANYTHING INCORPORATED OR EMBODIED THEREIN. + +IN NO EVENT SHALL THE PROVIDERS OF THE MODEL MATERIALS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT +OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MODEL +MATERIALS, THE USE THEREOF OR OTHER DEALINGS THEREIN. diff --git a/inference/models/cosmos3/__init__.py b/inference/models/cosmos3/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/inference/models/cosmos3/cosmos3_reasoner_inference_models.py b/inference/models/cosmos3/cosmos3_reasoner_inference_models.py new file mode 100644 index 0000000000..331b2686b6 --- /dev/null +++ b/inference/models/cosmos3/cosmos3_reasoner_inference_models.py @@ -0,0 +1,102 @@ +from typing import Any, List + +import torch + +from inference.core.entities.responses import ( + InferenceResponseImage, + LMMInferenceResponse, +) +from inference.core.env import ( + ALLOW_INFERENCE_MODELS_DIRECTLY_ACCESS_LOCAL_PACKAGES, + ALLOW_INFERENCE_MODELS_UNTRUSTED_PACKAGES, + API_KEY, + DISABLED_INFERENCE_MODELS_BACKENDS, + VALID_INFERENCE_MODELS_BACKENDS, +) +from inference.core.models.base import Model +from inference.core.models.types import PreprocessReturnMetadata +from inference.core.roboflow_api import get_extra_weights_provider_headers +from inference.core.utils.image_utils import load_image_bgr +from inference_models import AutoModel, PreProcessingOverrides +from inference_models.models.cosmos3.cosmos3_reasoner_hf import Cosmos3EdgeReasoner + + +class InferenceModelsCosmos3ReasonerAdapter(Model): + def __init__(self, model_id: str, api_key: str = None, **kwargs): + super().__init__() + + self.metrics = {"num_inferences": 0, "avg_inference_time": 0.0} + + self.api_key = api_key if api_key else API_KEY + + self.task_type = "lmm" + + extra_weights_provider_headers = get_extra_weights_provider_headers( + countinference=kwargs.get("countinference"), + service_secret=kwargs.get("service_secret"), + ) + backend = list( + VALID_INFERENCE_MODELS_BACKENDS.difference( + DISABLED_INFERENCE_MODELS_BACKENDS + ) + ) + self._model: Cosmos3EdgeReasoner = AutoModel.from_pretrained( + model_id_or_path=model_id, + api_key=self.api_key, + allow_untrusted_packages=ALLOW_INFERENCE_MODELS_UNTRUSTED_PACKAGES, + allow_direct_local_storage_loading=ALLOW_INFERENCE_MODELS_DIRECTLY_ACCESS_LOCAL_PACKAGES, + weights_provider_extra_headers=extra_weights_provider_headers, + backend=backend, + **kwargs, + ) + + def map_inference_kwargs(self, kwargs: dict) -> dict: + pre_processing_overrides = PreProcessingOverrides( + disable_contrast_enhancement=kwargs.get("disable_preproc_contrast", False), + disable_grayscale=kwargs.get("disable_preproc_grayscale", False), + disable_static_crop=kwargs.get("disable_preproc_static_crop", False), + ) + kwargs["pre_processing_overrides"] = pre_processing_overrides + return kwargs + + def preprocess(self, image: Any, prompt: str = "", **kwargs): + is_batch = isinstance(image, list) + if is_batch: + raise ValueError("This model does not support batched-inference.") + np_image = load_image_bgr( + image, + disable_preproc_auto_orient=kwargs.get( + "disable_preproc_auto_orient", False + ), + ) + input_shape = PreprocessReturnMetadata({"image_dims": np_image.shape[:2][::-1]}) + mapped_kwargs = self.map_inference_kwargs(kwargs) + return ( + self._model.pre_process_generation(np_image, prompt, **mapped_kwargs), + input_shape, + ) + + def predict(self, inputs, **kwargs) -> torch.Tensor: + mapped_kwargs = self.map_inference_kwargs(kwargs) + return self._model.generate(inputs, **mapped_kwargs) + + def postprocess( + self, + predictions: torch.Tensor, + preprocess_return_metadata: PreprocessReturnMetadata, + **kwargs, + ) -> List[LMMInferenceResponse]: + mapped_kwargs = self.map_inference_kwargs(kwargs) + result = self._model.post_process_generation(predictions, **mapped_kwargs)[0] + return [ + LMMInferenceResponse( + response=result, + image=InferenceResponseImage( + width=preprocess_return_metadata["image_dims"][0], + height=preprocess_return_metadata["image_dims"][1], + ), + ) + ] + + def clear_cache(self, delete_from_disk: bool = True) -> None: + pass diff --git a/inference/models/utils.py b/inference/models/utils.py index 16436a5425..04969e3bec 100644 --- a/inference/models/utils.py +++ b/inference/models/utils.py @@ -15,6 +15,7 @@ CORE_MODEL_SAM_ENABLED, CORE_MODEL_TROCR_ENABLED, CORE_MODEL_YOLO_WORLD_ENABLED, + COSMOS3_ENABLED, DEPTH_ESTIMATION_ENABLED, FLORENCE2_ENABLED, GLM_OCR_ENABLED, @@ -494,6 +495,31 @@ category=ModelDependencyMissing, ) +try: + # Cosmos 3 Edge has no legacy implementation โ€” it is served exclusively + # through the inference_models bridge adapter. + if COSMOS3_ENABLED and USE_INFERENCE_MODELS: + from inference.models.cosmos3.cosmos3_reasoner_inference_models import ( + InferenceModelsCosmos3ReasonerAdapter, + ) + + cosmos3_models = { + ( + "text-image-pairs", + "cosmos-3-edge", + ): InferenceModelsCosmos3ReasonerAdapter, + ("vlm", "cosmos-3-edge"): InferenceModelsCosmos3ReasonerAdapter, + } + ROBOFLOW_MODEL_TYPES.update(cosmos3_models) +except: + warnings.warn( + "Your `inference` configuration does not support the Cosmos 3 model. " + "Since inference 1.3.6 was shipped when downstream model dependencies were not released yet, " + "we have enabled the model in selected builds only. Installation guide will be provided " + "in following releases. To suppress this warning, set COSMOS3_ENABLED to False.", + category=ModelDependencyMissing, + ) + try: if CORE_MODEL_SAM_ENABLED: diff --git a/inference_models/development/cosmos3/pull_weights.py b/inference_models/development/cosmos3/pull_weights.py new file mode 100644 index 0000000000..e84bcf9412 --- /dev/null +++ b/inference_models/development/cosmos3/pull_weights.py @@ -0,0 +1,215 @@ +"""Pull NVIDIA Cosmos 3 Edge weights and materialize inference_models package layouts. + +The HF repo (nvidia/Cosmos3-Edge) is dual-format: a transformers-style reasoner at +the repo root and a diffusers-style generator (model_index.json + transformer/ + +vae/ + scheduler/). The two towers share weight files (the reasoner's +model.safetensors.index.json maps into transformer/*.safetensors and +vision_encoder/model.safetensors), so this script downloads ONE snapshot and +materializes each tower's package directory from it with hardlinks (falling back +to copies across filesystems). + +Package layouts produced (what `from_pretrained` expects): + + /cosmos-3-edge/ -> Cosmos3EdgeReasoner.from_pretrained(...) + /cosmos-3-edge-world/ -> Cosmos3EdgeWorldModel.from_pretrained(...) + +The world package additionally needs a `cosmos3_generator_runtime.py` at its root +(the self-contained runtime module the loader imports). Pass --runtime-module to +inject one; the reference implementation lives next to this script +(reference_generator_runtime.py). + +To mirror a package into GCS (same layout, no wrapping directory), pass +--gcs-dest; each package uploads to //: + + python pull_weights.py --towers reasoner,world \ + --runtime-module reference_generator_runtime.py \ + --gcs-dest gs://my-bucket/cosmos3 + +Use --dry-run to print the file plan without touching disk or GCS. +""" + +import argparse +import fnmatch +import os +import shutil +import subprocess +import sys + +HF_REPO = "nvidia/Cosmos3-Edge" +RUNTIME_MODULE_NAME = "cosmos3_generator_runtime.py" + +SNAPSHOT_IGNORE = ["assets/*", "images/*"] + +# Files each tower's package needs, as fnmatch patterns over repo-relative paths. +TOWER_FILES = { + "reasoner": [ + "config.json", + "generation_config.json", + "model.safetensors.index.json", + "chat_template.jinja", + "tokenizer.json", + "tokenizer_config.json", + "special_tokens_map.json", + "preprocessor_config.json", + "processor_config.json", + "video_preprocessor_config.json", + "vision_encoder/*", + # shared MoT weights - the reasoner index maps into these shards + "transformer/diffusion_pytorch_model*.safetensors", + ], + "world": [ + "model_index.json", + "modular_model_index.json", + "negative_prompt.json", + "scheduler/*", + "transformer/*", + "vae/*", + "text_tokenizer/*", + ], +} + +PACKAGE_NAMES = { + "reasoner": "cosmos-3-edge", + "world": "cosmos-3-edge-world", +} + + +def main() -> int: + args = _parse_args() + towers = [t.strip() for t in args.towers.split(",") if t.strip()] + unknown = set(towers).difference(TOWER_FILES) + if unknown: + raise SystemExit(f"Unknown tower(s): {sorted(unknown)}; pick from {sorted(TOWER_FILES)}") + + snapshot_dir = args.snapshot_dir or _download_snapshot(args) + available = _list_snapshot_files(snapshot_dir) + + for tower in towers: + package_dir = os.path.join(args.output_dir, PACKAGE_NAMES[tower]) + selected = _select_files(available, TOWER_FILES[tower]) + if not selected: + raise SystemExit(f"No files matched for tower '{tower}' in {snapshot_dir}") + print(f"[{tower}] {len(selected)} files -> {package_dir}") + if args.dry_run: + for rel in selected: + print(f" {rel}") + else: + _materialize(snapshot_dir, package_dir, selected) + if tower == "world": + _inject_runtime_module(args, package_dir) + if args.gcs_dest: + _upload_to_gcs( + package_dir=package_dir, + gcs_dest=f"{args.gcs_dest.rstrip('/')}/{PACKAGE_NAMES[tower]}", + dry_run=args.dry_run, + ) + return 0 + + +def _parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser(description=__doc__.split("\n")[0]) + parser.add_argument("--hf-repo", default=HF_REPO) + parser.add_argument("--revision", default=None, help="HF revision/tag to pin.") + parser.add_argument( + "--snapshot-dir", + default=None, + help="Reuse an existing snapshot directory instead of downloading.", + ) + parser.add_argument( + "--output-dir", + default="checkpoints/packages", + help="Directory receiving one package subdirectory per tower.", + ) + parser.add_argument( + "--towers", + default="reasoner,world", + help="Comma-separated subset of: reasoner, world.", + ) + parser.add_argument( + "--runtime-module", + default=None, + help=f"Python file copied into the world package as {RUNTIME_MODULE_NAME}.", + ) + parser.add_argument( + "--gcs-dest", + default=None, + help="gs://bucket/prefix - each package is mirrored to //.", + ) + parser.add_argument("--dry-run", action="store_true") + return parser.parse_args() + + +def _download_snapshot(args: argparse.Namespace) -> str: + from huggingface_hub import snapshot_download + + print(f"Downloading snapshot of {args.hf_repo} (weights only)...") + return snapshot_download( + args.hf_repo, + revision=args.revision, + ignore_patterns=SNAPSHOT_IGNORE, + ) + + +def _list_snapshot_files(snapshot_dir: str) -> list: + collected = [] + for root, _, files in os.walk(snapshot_dir): + for name in files: + path = os.path.join(root, name) + rel = os.path.relpath(path, snapshot_dir) + if rel.startswith(".cache"): + continue + collected.append(rel) + return sorted(collected) + + +def _select_files(available: list, patterns: list) -> list: + return [ + rel + for rel in available + if any(fnmatch.fnmatch(rel, pattern) for pattern in patterns) + ] + + +def _materialize(snapshot_dir: str, package_dir: str, selected: list) -> None: + for rel in selected: + src = os.path.realpath(os.path.join(snapshot_dir, rel)) + dst = os.path.join(package_dir, rel) + os.makedirs(os.path.dirname(dst), exist_ok=True) + if os.path.exists(dst): + continue + try: + os.link(src, dst) + except OSError: + shutil.copy2(src, dst) + + +def _inject_runtime_module(args: argparse.Namespace, package_dir: str) -> None: + if not args.runtime_module: + print( + f" note: world package has no {RUNTIME_MODULE_NAME}; " + "Cosmos3EdgeWorldModel.from_pretrained will refuse to load it " + "(pass --runtime-module)." + ) + return + dst = os.path.join(package_dir, RUNTIME_MODULE_NAME) + print(f" runtime module: {args.runtime_module} -> {dst}") + if not args.dry_run: + os.makedirs(package_dir, exist_ok=True) + shutil.copy2(args.runtime_module, dst) + + +def _upload_to_gcs(package_dir: str, gcs_dest: str, dry_run: bool) -> None: + tool = shutil.which("gcloud") + if tool: + cmd = ["gcloud", "storage", "cp", "-r", f"{package_dir.rstrip('/')}/*", gcs_dest + "/"] + elif shutil.which("gsutil"): + cmd = ["gsutil", "-m", "cp", "-r", f"{package_dir.rstrip('/')}/*", gcs_dest + "/"] + else: + raise SystemExit("Neither gcloud nor gsutil found on PATH for --gcs-dest.") + print(f" upload: {' '.join(cmd)}") + if not dry_run: + subprocess.run(" ".join(cmd), shell=True, check=True) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/inference_models/development/cosmos3/reference_generator_runtime.py b/inference_models/development/cosmos3/reference_generator_runtime.py new file mode 100644 index 0000000000..7491faee87 --- /dev/null +++ b/inference_models/development/cosmos3/reference_generator_runtime.py @@ -0,0 +1,188 @@ +"""Reference `cosmos3_generator_runtime.py` for the Cosmos 3 Edge world package. + +This is the self-contained runtime module that ships INSIDE the +`cosmos-3-edge-world` model package (injected by pull_weights.py +--runtime-module). `Cosmos3EdgeWorldModel.from_pretrained` imports the +`Cosmos3GeneratorRuntime` class from it via `import_class_from_file`. + +Backed by diffusers' `Cosmos3OmniPipeline` (diffusers>=0.39), so the only +runtime dependencies are torch + diffusers + transformers - NVIDIA's +cosmos-framework is not required for image-to-video. + +Contract expected by Cosmos3EdgeWorldModel (all images RGB numpy arrays): +- load(package_dir, device) -> runtime +- generate_video(images, prompt, num_frames, fps, resolution, seed) -> [frames] +- encode_context(frames) -> session +- rollout(session, actions, num_frames) -> ([frames], session) +- infer_actions(frames) -> {actions, action_space, fps, metadata} + +Forward/inverse dynamics ride the pipeline's action-conditioning path +(`CosmosActionCondition`): forward dynamics conditions each chunk on the last +generated frame of the previous chunk (carried in the session dict), inverse +dynamics infers the action sequence connecting the frames of an observation +video. `action_space` maps to the pipeline's embodiment `domain_name` +(e.g. "umi", "av", "droid_lerobot"). +""" + +from typing import List, Optional + +import numpy as np +import torch + + +class Cosmos3GeneratorRuntime: + + @classmethod + def load(cls, package_dir: str, device: torch.device) -> "Cosmos3GeneratorRuntime": + from diffusers import Cosmos3OmniPipeline + + pipeline = Cosmos3OmniPipeline.from_pretrained( + package_dir, + torch_dtype=torch.bfloat16, + ) + pipeline.to(device) + return cls(pipeline=pipeline, device=device) + + def __init__(self, pipeline, device: torch.device): + self._pipeline = pipeline + self._device = device + + def generate_video( + self, + images: List[np.ndarray], + prompt: Optional[str], + num_frames: int, + fps: int, + resolution: int, + seed: Optional[int], + num_inference_steps: int = 35, + ) -> List[np.ndarray]: + from PIL import Image + + conditioning = Image.fromarray(images[0]) + generator = None + if seed is not None: + generator = torch.Generator(device=self._device).manual_seed(seed) + height, width = _resolve_resolution(resolution) + result = self._pipeline( + prompt=prompt or "", + image=conditioning, + num_frames=num_frames, + height=height, + width=width, + fps=float(fps), + num_inference_steps=num_inference_steps, + generator=generator, + output_type="np", + enable_safety_check=False, + ) + return [frame for frame in _to_uint8(result.video)] + + def encode_context( + self, + frames: List[np.ndarray], + prompt: Optional[str] = None, + view_point: str = "ego_view", + resolution_tier: int = 256, + **kwargs, + ) -> dict: + # The session carries the frame each subsequent chunk conditions on, + # plus the generation context that stays fixed across the rollout. + return { + "conditioning_frame": np.asarray(frames[-1]), + "prompt": prompt, + "view_point": view_point, + "resolution_tier": resolution_tier, + } + + def rollout( + self, + session: dict, + actions: np.ndarray, + num_frames: int, + action_space: str = "umi", + seed: Optional[int] = None, + num_inference_steps: int = 35, + **kwargs, + ): + from diffusers.pipelines.cosmos.pipeline_cosmos3_omni import ( + CosmosActionCondition, + ) + from PIL import Image + + condition = CosmosActionCondition( + mode="forward_dynamics", + chunk_size=len(actions), + domain_name=action_space, + resolution_tier=session["resolution_tier"], + raw_actions=torch.as_tensor(np.asarray(actions), dtype=torch.float32), + image=Image.fromarray(session["conditioning_frame"]), + view_point=session["view_point"], + ) + generator = None + if seed is not None: + generator = torch.Generator(device=self._device).manual_seed(seed) + result = self._pipeline( + prompt=session.get("prompt") or "", + action=condition, + num_inference_steps=num_inference_steps, + generator=generator, + output_type="np", + enable_safety_check=False, + ) + video = _to_uint8(result.video) + updated_session = dict(session) + updated_session["conditioning_frame"] = video[-1] + return [frame for frame in video], updated_session + + def infer_actions( + self, + frames: List[np.ndarray], + action_space: str = "umi", + view_point: str = "ego_view", + resolution_tier: int = 256, + fps: float = 20.0, + num_inference_steps: int = 35, + **kwargs, + ) -> dict: + from diffusers.pipelines.cosmos.pipeline_cosmos3_omni import ( + CosmosActionCondition, + ) + + condition = CosmosActionCondition( + mode="inverse_dynamics", + chunk_size=max(1, len(frames) - 1), + domain_name=action_space, + resolution_tier=resolution_tier, + video=[np.asarray(frame) for frame in frames], + view_point=view_point, + ) + result = self._pipeline( + prompt="", + action=condition, + num_inference_steps=num_inference_steps, + output_type="np", + enable_safety_check=False, + ) + chunks = [chunk.float().cpu().numpy() for chunk in (result.action or [])] + actions = np.concatenate(chunks, axis=0) if chunks else np.zeros((0, 0)) + return { + "actions": actions, + "action_space": action_space, + "fps": fps, + "metadata": {"view_point": view_point, "num_chunks": len(chunks)}, + } + + +def _to_uint8(video) -> np.ndarray: + video = np.asarray(video) + if video.dtype != np.uint8: + video = (np.clip(video, 0.0, 1.0) * 255).astype(np.uint8) + return video + + +def _resolve_resolution(resolution: int): + # 16:9 at the requested height, aligned to the VAE's spatial stride. + height = max(16, (resolution // 16) * 16) + width = max(16, ((resolution * 16 // 9) // 16) * 16) + return height, width diff --git a/inference_models/docs/changelog.md b/inference_models/docs/changelog.md index 325905365a..e7a96d1b6f 100644 --- a/inference_models/docs/changelog.md +++ b/inference_models/docs/changelog.md @@ -39,6 +39,15 @@ Add user-facing changes below using `### Added`, `### Changed`, `### Fixed`, or - Composable RF-DETR TensorRT execution plans, implementation contracts and registries, compatibility-aware implementation selection, and runtime metadata reporting the requested and effective preprocessing and postprocessing implementations. +- NVIDIA Cosmos 3 Edge reasoner (`cosmos-3-edge`, task `vlm`, backend `hugging-face`): + image/video + text prompting via `prompt(...)` / `prompt_video(...)`, following the + standard VLM contract. The generative world-model tower ships separately. +- NVIDIA Cosmos 3 Edge generator (`cosmos-3-edge-world`, task `world-model`, backend + `custom`): image-to-video (`generate_video`), forward dynamics (`start_rollout` + + `forward_dynamics` with explicit session-state threading), and inverse dynamics + (`inverse_dynamics`). The step-wise robot policy mode is deferred. The denoising + runtime ships inside the model package (loaded via `import_class_from_file`), keeping + NVIDIA's cosmos stack out of `inference_models` dependencies. - `segment_with_text_prompts` accepts `max_detections` (top-k by score, applied before mask interpolation; default `-1` = uncapped) and `mask_format` (`"dense"` default, or `"rle"` for COCO RLE at original resolution). diff --git a/inference_models/inference_models/configuration.py b/inference_models/inference_models/configuration.py index 3adbe6ccb7..9bbde56c47 100644 --- a/inference_models/inference_models/configuration.py +++ b/inference_models/inference_models/configuration.py @@ -237,6 +237,14 @@ variable_name="INFERENCE_MODELS_QWEN3_VL_DEFAULT_DO_SAMPLE", default=INFERENCE_MODELS_DEFAULT_DO_SAMPLE, ) +INFERENCE_MODELS_COSMOS3_DEFAULT_MAX_NEW_TOKENS = get_integer_from_env( + variable_name="INFERENCE_MODELS_COSMOS3_DEFAULT_MAX_NEW_TOKENS", + default=512, +) +INFERENCE_MODELS_COSMOS3_DEFAULT_DO_SAMPLE = get_boolean_from_env( + variable_name="INFERENCE_MODELS_COSMOS3_DEFAULT_DO_SAMPLE", + default=INFERENCE_MODELS_DEFAULT_DO_SAMPLE, +) INFERENCE_MODELS_GLM_OCR_DEFAULT_MAX_NEW_TOKENS = get_integer_from_env( variable_name="INFERENCE_MODELS_GLM_OCR_DEFAULT_MAX_NEW_TOKENS", default=8192, diff --git a/inference_models/inference_models/models/auto_loaders/models_registry.py b/inference_models/inference_models/models/auto_loaders/models_registry.py index 48345e3288..ccce3ae0df 100644 --- a/inference_models/inference_models/models/auto_loaders/models_registry.py +++ b/inference_models/inference_models/models/auto_loaders/models_registry.py @@ -23,6 +23,7 @@ GAZE_DETECTION_TASK = "gaze-detection" OPEN_VOCABULARY_OBJECT_DETECTION_TASK = "open-vocabulary-object-detection" INTERACTIVE_INSTANCE_SEGMENTATION_TASK = "interactive-instance-segmentation" +WORLD_MODEL_TASK = "world-model" @dataclass(frozen=True) @@ -294,6 +295,14 @@ class RegistryEntry: module_name="inference_models.models.qwen3vl.qwen3vl_hf", class_name="Qwen3VLHF", ), + ("cosmos-3-edge", VLM_TASK, BackendType.HF): LazyClass( + module_name="inference_models.models.cosmos3.cosmos3_reasoner_hf", + class_name="Cosmos3EdgeReasoner", + ), + ("cosmos-3-edge-world", WORLD_MODEL_TASK, BackendType.CUSTOM): LazyClass( + module_name="inference_models.models.cosmos3.cosmos3_world", + class_name="Cosmos3EdgeWorldModel", + ), ("qwen3_5", VLM_TASK, BackendType.HF): LazyClass( module_name="inference_models.models.qwen3_5.qwen3_5_hf", class_name="Qwen35HF", diff --git a/inference_models/inference_models/models/cosmos3/LICENSE.txt b/inference_models/inference_models/models/cosmos3/LICENSE.txt new file mode 100644 index 0000000000..52f32cc9c1 --- /dev/null +++ b/inference_models/inference_models/models/cosmos3/LICENSE.txt @@ -0,0 +1,55 @@ +NVIDIA Cosmos 3 Edge is released under the OpenMDW License Agreement, +version 1.1 (OpenMDW-1.1): https://openmdw.ai/license/1-1/ + +---------------------------------------------------------------------- + +OpenMDW License Agreement, version 1.1 (OpenMDW-1.1) + +By exercising rights granted to you under this agreement, you accept and +agree to its terms. + +As used in this agreement, "Model Materials" means the materials provided +to you under this agreement, consisting of: (1) one or more machine +learning models (including architecture and parameters); and (2) all +related artifacts (including associated data, documentation and software) +that are provided to you hereunder. + +Subject to your compliance with this agreement, permission is hereby +granted, free of charge, to deal in the Model Materials without +restriction, including under all copyright, patent, database, and trade +secret rights included or embodied therein. + +If you distribute any portion of the Model Materials, you shall retain in +your distribution (1) a copy of this agreement, and (2) all copyright +notices and other notices of origin included in the Model Materials that +are applicable to your distribution. + +If you file, maintain, or voluntarily participate in a lawsuit against +any person or entity asserting that the Model Materials directly or +indirectly infringe any patent or copyright, then all rights and grants +made to you hereunder are terminated, unless that lawsuit was in response +to a corresponding lawsuit first brought against you. + +This agreement does not impose any restrictions or obligations with +respect to any use, modification, or sharing of any outputs generated by +using the Model Materials. + +THE MODEL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NONINFRINGEMENT, +ACCURACY, OR THE ABSENCE OF LATENT OR OTHER DEFECTS OR ERRORS, WHETHER OR +NOT DISCOVERABLE, ALL TO THE GREATEST EXTENT PERMISSIBLE UNDER APPLICABLE +LAW. + +YOU ARE SOLELY RESPONSIBLE FOR (1) CLEARING RIGHTS OF OTHER PERSONS THAT +MAY APPLY TO THE MODEL MATERIALS OR ANY USE THEREOF, INCLUDING WITHOUT +LIMITATION ANY PERSON'S COPYRIGHTS OR OTHER RIGHTS INCLUDED OR EMBODIED IN +THE MODEL MATERIALS; (2) OBTAINING ANY NECESSARY CONSENTS, PERMISSIONS OR +OTHER RIGHTS REQUIRED FOR ANY USE OF THE MODEL MATERIALS; OR (3) +PERFORMING ANY DUE DILIGENCE OR UNDERTAKING ANY OTHER INVESTIGATIONS INTO +THE MODEL MATERIALS OR ANYTHING INCORPORATED OR EMBODIED THEREIN. + +IN NO EVENT SHALL THE PROVIDERS OF THE MODEL MATERIALS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT +OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MODEL +MATERIALS, THE USE THEREOF OR OTHER DEALINGS THEREIN. diff --git a/inference_models/inference_models/models/cosmos3/__init__.py b/inference_models/inference_models/models/cosmos3/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/inference_models/inference_models/models/cosmos3/cosmos3_reasoner_hf.py b/inference_models/inference_models/models/cosmos3/cosmos3_reasoner_hf.py new file mode 100644 index 0000000000..3e3ef18ecc --- /dev/null +++ b/inference_models/inference_models/models/cosmos3/cosmos3_reasoner_hf.py @@ -0,0 +1,295 @@ +""" +This is inference-models wrapper for the reasoner tower of NVIDIA Cosmos 3 Edge, +originally published in https://huggingface.co/nvidia/Cosmos3-Edge +""" + +import re +from threading import Lock +from typing import Any, Dict, List, Optional, Tuple, Union + +import numpy as np +import torch +from transformers import AutoModelForImageTextToText, AutoProcessor +from transformers.utils import is_flash_attn_2_available + +from inference_models.configuration import ( + DEFAULT_DEVICE, + INFERENCE_MODELS_COSMOS3_DEFAULT_DO_SAMPLE, + INFERENCE_MODELS_COSMOS3_DEFAULT_MAX_NEW_TOKENS, + RUNNING_ON_JETSON, +) +from inference_models.entities import ColorFormat + +DEFAULT_PROMPT = "Describe what's in this image." +SYSTEM_PROMPT_SENTINEL = "" +THINK_BLOCK_PATTERN = re.compile(r".*?\s*", flags=re.DOTALL) +THINK_EXTRACT_PATTERN = re.compile(r"(.*?)", flags=re.DOTALL) + + +def _get_cosmos3_attn_implementation(device: torch.device) -> str: + if ( + is_flash_attn_2_available() + and device + and "cuda" in str(device) + and not RUNNING_ON_JETSON + ): + try: + import flash_attn # noqa: F401 + + if _is_ampere_plus(device=device): + return "flash_attention_2" + return "eager" + except ImportError: + pass + return "eager" + + +def _is_ampere_plus(device: torch.device) -> bool: + if device.type != "cuda": + return False + major, _ = torch.cuda.get_device_capability(device=device) + return major >= 8 + + +def _resolve_default_dtype(device: torch.device) -> torch.dtype: + if device.type == "cuda": + if torch.cuda.is_bf16_supported(): + return torch.bfloat16 + return torch.float16 + return torch.float32 + + +class Cosmos3EdgeReasoner: + """NVIDIA Cosmos 3 Edge reasoner tower (image/video + text -> text). + + Only the autoregressive reasoner is exposed here; the diffusion generator + (image-to-video, dynamics, policy) has a separate implementation and + registry entry. + """ + + default_dtype = torch.bfloat16 + + @classmethod + def from_pretrained( + cls, + model_name_or_path: str, + device: torch.device = DEFAULT_DEVICE, + trust_remote_code: bool = False, + local_files_only: bool = True, + quantization_config: Any = None, + **kwargs, + ) -> "Cosmos3EdgeReasoner": + dtype = _resolve_default_dtype(device) + attn_implementation = _get_cosmos3_attn_implementation(device) + model = AutoModelForImageTextToText.from_pretrained( + model_name_or_path, + device_map=device, + dtype=dtype, + trust_remote_code=trust_remote_code, + local_files_only=local_files_only, + quantization_config=quantization_config, + attn_implementation=attn_implementation, + ).eval() + processor = AutoProcessor.from_pretrained( + model_name_or_path, + trust_remote_code=trust_remote_code, + local_files_only=local_files_only, + ) + return cls(model=model, processor=processor, device=device) + + def __init__( + self, + model, + processor, + device: torch.device, + ): + self._model = model + self._processor = processor + self._device = device + self._torch_dtype = next(model.parameters()).dtype + self.default_system_prompt = ( + "You are Cosmos, a helpful assistant that understands physical scenes " + "and answers questions about images and videos." + ) + self._lock = Lock() + + def prompt( + self, + images: Union[torch.Tensor, List[torch.Tensor], np.ndarray, List[np.ndarray]], + prompt: str = None, + input_color_format: ColorFormat = None, + max_new_tokens: Optional[int] = INFERENCE_MODELS_COSMOS3_DEFAULT_MAX_NEW_TOKENS, + do_sample: bool = INFERENCE_MODELS_COSMOS3_DEFAULT_DO_SAMPLE, + skip_special_tokens: bool = True, + return_thinking: bool = False, + **kwargs, + ) -> Union[List[str], List[Dict[str, str]]]: + inputs = self.pre_process_generation( + images=images, prompt=prompt, input_color_format=input_color_format + ) + generated_ids = self.generate( + inputs=inputs, + max_new_tokens=max_new_tokens, + do_sample=do_sample, + ) + return self.post_process_generation( + generated_ids=generated_ids, + skip_special_tokens=skip_special_tokens, + return_thinking=return_thinking, + ) + + def prompt_video( + self, + frames: List[np.ndarray], + prompt: str = None, + input_color_format: ColorFormat = None, + max_new_tokens: Optional[int] = INFERENCE_MODELS_COSMOS3_DEFAULT_MAX_NEW_TOKENS, + do_sample: bool = INFERENCE_MODELS_COSMOS3_DEFAULT_DO_SAMPLE, + skip_special_tokens: bool = True, + return_thinking: bool = False, + **kwargs, + ) -> Union[str, Dict[str, str]]: + inputs = self.pre_process_generation( + images=frames, + prompt=prompt, + input_color_format=input_color_format, + as_video=True, + ) + generated_ids = self.generate( + inputs=inputs, + max_new_tokens=max_new_tokens, + do_sample=do_sample, + ) + return self.post_process_generation( + generated_ids=generated_ids, + skip_special_tokens=skip_special_tokens, + return_thinking=return_thinking, + )[0] + + def pre_process_generation( + self, + images: Union[torch.Tensor, List[torch.Tensor], np.ndarray, List[np.ndarray]], + prompt: str = None, + input_color_format: ColorFormat = None, + as_video: bool = False, + **kwargs, + ) -> dict: + if isinstance(images, np.ndarray): + if input_color_format != "rgb": + images = images[:, :, ::-1] + images = images.copy() + elif as_video and input_color_format != "rgb": + images = [ + frame[:, :, ::-1].copy() if isinstance(frame, np.ndarray) else frame + for frame in images + ] + prompt, system_prompt = self._parse_prompt(prompt=prompt) + visual_content = ( + {"type": "video", "video": images} + if as_video + else {"type": "image", "image": images} + ) + conversation = [ + { + "role": "system", + "content": [{"type": "text", "text": system_prompt}], + }, + { + "role": "user", + "content": [ + visual_content, + {"type": "text", "text": prompt}, + ], + }, + ] + text_input = self._processor.apply_chat_template( + conversation, tokenize=False, add_generation_prompt=True + ) + processor_kwargs = {"videos": [images]} if as_video else {"images": images} + model_inputs = self._processor( + text=text_input, + return_tensors="pt", + padding=True, + **processor_kwargs, + ) + return { + k: ( + v.to(self._device, dtype=self._torch_dtype) + if v.is_floating_point() + else v.to(self._device) + ) + for k, v in model_inputs.items() + if isinstance(v, torch.Tensor) + } + + def generate( + self, + inputs: dict, + max_new_tokens: Optional[int] = INFERENCE_MODELS_COSMOS3_DEFAULT_MAX_NEW_TOKENS, + do_sample: bool = INFERENCE_MODELS_COSMOS3_DEFAULT_DO_SAMPLE, + **kwargs, + ) -> torch.Tensor: + if max_new_tokens is None: + max_new_tokens = INFERENCE_MODELS_COSMOS3_DEFAULT_MAX_NEW_TOKENS + input_len = inputs["input_ids"].shape[-1] + tokenizer = self._processor.tokenizer + pad_token_id = ( + getattr(tokenizer, "pad_token_id", None) or tokenizer.eos_token_id + ) + with self._lock, torch.inference_mode(): + generation = self._model.generate( + **inputs, + max_new_tokens=max_new_tokens, + do_sample=do_sample, + pad_token_id=pad_token_id, + eos_token_id=tokenizer.eos_token_id, + ) + return generation[:, input_len:] + + def post_process_generation( + self, + generated_ids: torch.Tensor, + skip_special_tokens: bool = True, + return_thinking: bool = False, + **kwargs, + ) -> Union[List[str], List[Dict[str, str]]]: + decoded = self._processor.batch_decode( + generated_ids, + skip_special_tokens=skip_special_tokens, + ) + result = [] + for text in decoded: + text = text.replace("assistant\n", "") + # The chat template opens the reasoning block inside the prompt, so + # decoded output carries a bare closing . Restore the + # opening tag so thinking and answer parse apart (qwen3_5 pattern). + if "" in text and "" not in text: + text = "" + text + if return_thinking: + think_match = THINK_EXTRACT_PATTERN.search(text) + if think_match: + thinking = think_match.group(1).strip() + answer = THINK_BLOCK_PATTERN.sub("", text).strip() + else: + thinking = text.replace("", "").strip() + answer = "" + result.append({"thinking": thinking, "answer": answer}) + else: + result.append(THINK_BLOCK_PATTERN.sub("", text).strip()) + return result + + def __call__( + self, + images: Union[torch.Tensor, List[torch.Tensor], np.ndarray, List[np.ndarray]], + **kwargs, + ) -> Union[List[str], List[Dict[str, str]]]: + return self.prompt(images, **kwargs) + + def _parse_prompt(self, prompt: Optional[str]) -> Tuple[str, str]: + if prompt is None: + return DEFAULT_PROMPT, self.default_system_prompt + split_prompt = prompt.split(SYSTEM_PROMPT_SENTINEL) + parsed_prompt = split_prompt[0] or DEFAULT_PROMPT + if len(split_prompt) == 1: + return parsed_prompt, self.default_system_prompt + return parsed_prompt, split_prompt[1] or self.default_system_prompt diff --git a/inference_models/inference_models/models/cosmos3/cosmos3_world.py b/inference_models/inference_models/models/cosmos3/cosmos3_world.py new file mode 100644 index 0000000000..ed366b2e3a --- /dev/null +++ b/inference_models/inference_models/models/cosmos3/cosmos3_world.py @@ -0,0 +1,213 @@ +from dataclasses import dataclass, field +from threading import Lock +from typing import List, Optional, Tuple, Union + +import numpy as np +import torch + +from inference_models.configuration import DEFAULT_DEVICE +from inference_models.entities import ColorFormat +from inference_models.errors import ModelInputError +from inference_models.models.cosmos3.runtime_loading import load_runtime_from_package + +RUNTIME_MODULE_FILE = "cosmos3_generator_runtime.py" +RUNTIME_CLASS_NAME = "Cosmos3GeneratorRuntime" +SESSION_KEY = "cosmos3_rollout_session" + +DEFAULT_NUM_FRAMES = 121 +DEFAULT_FPS = 24 +DEFAULT_RESOLUTION = 480 + + +@dataclass +class Cosmos3ActionTrajectory: + """A robot action trajectory - consumed by forward dynamics, produced by + inverse dynamics.""" + + actions: np.ndarray # (T, action_dim) + action_space: str + fps: float + metadata: dict = field(default_factory=dict) + + +@dataclass +class Cosmos3Rollout: + """Result of a generation / dynamics call. + + `frames` are BGR (repo-wide convention). `state_dict` is opaque live + session state - thread it back into the next `forward_dynamics()` call, + never introspect or serialize it. + """ + + frames: List[np.ndarray] + fps: float + resolution: Tuple[int, int] + actions: Optional[Cosmos3ActionTrajectory] = None + state_dict: Optional[dict] = None + + +class Cosmos3EdgeWorldModel: + """NVIDIA Cosmos 3 Edge generator tower. + + Modes exposed: image-to-video (`generate_video`), forward dynamics + (`start_rollout` + `forward_dynamics`), inverse dynamics + (`inverse_dynamics`). The policy mode (step-wise robot control) is + deliberately not exposed yet. + """ + + @classmethod + def from_pretrained( + cls, + model_name_or_path: str, + device: torch.device = DEFAULT_DEVICE, + **kwargs, + ) -> "Cosmos3EdgeWorldModel": + runtime_class = load_runtime_from_package( + model_name_or_path=model_name_or_path, + runtime_module_file=RUNTIME_MODULE_FILE, + runtime_class_name=RUNTIME_CLASS_NAME, + ) + runtime = runtime_class.load(model_name_or_path, device=device) + return cls(runtime=runtime, device=device) + + def __init__(self, runtime, device: torch.device): + self._runtime = runtime + self._device = device + self._lock = Lock() + + def generate_video( + self, + images: Union[np.ndarray, List[np.ndarray]], + prompt: Optional[str] = None, + num_frames: int = DEFAULT_NUM_FRAMES, + fps: int = DEFAULT_FPS, + resolution: int = DEFAULT_RESOLUTION, + seed: Optional[int] = None, + input_color_format: ColorFormat = None, + **kwargs, + ) -> Cosmos3Rollout: + conditioning = _as_rgb_frames(images, input_color_format=input_color_format) + with self._lock: + generated = self._runtime.generate_video( + images=conditioning, + prompt=prompt, + num_frames=num_frames, + fps=fps, + resolution=resolution, + seed=seed, + ) + frames = [_rgb_to_bgr(frame) for frame in generated] + return Cosmos3Rollout( + frames=frames, + fps=float(fps), + resolution=_frames_resolution(frames), + ) + + def start_rollout( + self, + frames: List[np.ndarray], + input_color_format: ColorFormat = None, + **session_options, + ) -> dict: + context = _as_rgb_frames(frames, input_color_format=input_color_format) + if not context: + raise ModelInputError( + message="start_rollout() requires at least one context frame.", + help_url="https://inference-models.roboflow.com/errors/models-input/#modelinputerror", + ) + with self._lock: + session = self._runtime.encode_context(frames=context, **session_options) + return {SESSION_KEY: session} + + def forward_dynamics( + self, + actions: Cosmos3ActionTrajectory, + state_dict: dict, + num_frames: Optional[int] = None, + **kwargs, + ) -> Cosmos3Rollout: + session = self._resolve_session(state_dict=state_dict) + if num_frames is None: + num_frames = len(actions.actions) + with self._lock: + generated, updated_session = self._runtime.rollout( + session=session, + actions=actions.actions, + num_frames=num_frames, + action_space=actions.action_space, + **kwargs, + ) + frames = [_rgb_to_bgr(frame) for frame in generated] + return Cosmos3Rollout( + frames=frames, + fps=actions.fps, + resolution=_frames_resolution(frames), + state_dict={SESSION_KEY: updated_session}, + ) + + def inverse_dynamics( + self, + frames: List[np.ndarray], + action_space: str, + input_color_format: ColorFormat = None, + **kwargs, + ) -> Cosmos3ActionTrajectory: + observation = _as_rgb_frames(frames, input_color_format=input_color_format) + if not observation: + raise ModelInputError( + message="inverse_dynamics() requires at least one observation frame.", + help_url="https://inference-models.roboflow.com/errors/models-input/#modelinputerror", + ) + with self._lock: + result = self._runtime.infer_actions( + frames=observation, action_space=action_space, **kwargs + ) + return Cosmos3ActionTrajectory( + actions=np.asarray(result["actions"]), + action_space=result["action_space"], + fps=float(result["fps"]), + metadata=result.get("metadata", {}), + ) + + def _resolve_session(self, state_dict: dict): + # A missing / foreign state_dict must fail loudly - silently creating + # an empty session would produce plausible-looking garbage rollouts. + if not isinstance(state_dict, dict) or SESSION_KEY not in state_dict: + raise ModelInputError( + message="forward_dynamics() requires the state_dict returned by " + "start_rollout() (or by a previous forward_dynamics() call). " + "Call start_rollout() with context frames first.", + help_url="https://inference-models.roboflow.com/errors/models-input/#modelinputerror", + ) + return state_dict[SESSION_KEY] + + +def _as_rgb_frames( + images: Union[np.ndarray, List[np.ndarray]], + input_color_format: ColorFormat, +) -> List[np.ndarray]: + if isinstance(images, np.ndarray): + images = [images] + frames = [] + for frame in images: + if not isinstance(frame, np.ndarray): + raise ModelInputError( + message="Cosmos 3 generator inputs must be numpy arrays " + f"(got {type(frame).__name__}).", + help_url="https://inference-models.roboflow.com/errors/models-input/#modelinputerror", + ) + if input_color_format != "rgb": + frame = frame[:, :, ::-1] + frames.append(np.ascontiguousarray(frame)) + return frames + + +def _rgb_to_bgr(frame: np.ndarray) -> np.ndarray: + return np.ascontiguousarray(np.asarray(frame)[:, :, ::-1]) + + +def _frames_resolution(frames: List[np.ndarray]) -> Tuple[int, int]: + if not frames: + return (0, 0) + height, width = frames[0].shape[:2] + return (width, height) diff --git a/inference_models/inference_models/models/cosmos3/runtime_loading.py b/inference_models/inference_models/models/cosmos3/runtime_loading.py new file mode 100644 index 0000000000..b6d54a1f03 --- /dev/null +++ b/inference_models/inference_models/models/cosmos3/runtime_loading.py @@ -0,0 +1,31 @@ +import os + +from inference_models.errors import ModelRuntimeError +from inference_models.utils.imports import import_class_from_file + + +def load_runtime_from_package( + model_name_or_path: str, + runtime_module_file: str, + runtime_class_name: str, +) -> type: + """Load a generator runtime class shipped inside a model package. + + The Cosmos 3 generator towers are not loadable through plain transformers: + their denoising loops come from NVIDIA's cosmos stack. Instead of making + that stack an `inference_models` dependency, the model package ships a + self-contained runtime module which this helper imports (same mechanism as + moondream2's package-local code). + """ + runtime_path = os.path.join(model_name_or_path, runtime_module_file) + if not os.path.exists(runtime_path): + raise ModelRuntimeError( + message=f"Model package at {model_name_or_path} does not contain the " + f"expected runtime module `{runtime_module_file}`. The package may be " + "corrupted or predate generator support.", + help_url="https://inference-models.roboflow.com/errors/models-runtime/#modelruntimeerror", + ) + return import_class_from_file( + file_path=runtime_path, + class_name=runtime_class_name, + ) diff --git a/inference_models/tests/integration_tests/models/test_cosmos3_predictions.py b/inference_models/tests/integration_tests/models/test_cosmos3_predictions.py new file mode 100644 index 0000000000..20187910bc --- /dev/null +++ b/inference_models/tests/integration_tests/models/test_cosmos3_predictions.py @@ -0,0 +1,114 @@ +"""Integration tests for Cosmos 3 Edge (reasoner + world model) on real weights. + +Both tests load from local package directories (the layouts produced by +`development/cosmos3/pull_weights.py`) pointed to by env vars, so they can run +before the packages are published to the weights provider: + + COSMOS3_REASONER_PACKAGE_DIR=checkpoints/packages/cosmos-3-edge \ + COSMOS3_WORLD_PACKAGE_DIR=checkpoints/packages/cosmos-3-edge-world \ + python -m pytest tests/integration_tests/models/test_cosmos3_predictions.py -m slow + +Once the packages are registered, conftest fixtures downloading the published +zips should replace the env-var indirection (matching the other model suites). +""" + +import os + +import numpy as np +import pytest +import torch + +REASONER_PACKAGE_DIR = os.environ.get("COSMOS3_REASONER_PACKAGE_DIR") +WORLD_PACKAGE_DIR = os.environ.get("COSMOS3_WORLD_PACKAGE_DIR") +CUDA_AVAILABLE = torch.cuda.is_available() + + +@pytest.mark.slow +@pytest.mark.skipif( + not REASONER_PACKAGE_DIR or not CUDA_AVAILABLE, + reason="COSMOS3_REASONER_PACKAGE_DIR not set or CUDA unavailable", +) +def test_cosmos3_reasoner_answers_scene_question() -> None: + from inference_models.models.cosmos3.cosmos3_reasoner_hf import ( + Cosmos3EdgeReasoner, + ) + + model = Cosmos3EdgeReasoner.from_pretrained( + REASONER_PACKAGE_DIR, device=torch.device("cuda") + ) + image = np.zeros((240, 320, 3), dtype=np.uint8) + image[:, 160:, 2] = 255 # right half red (BGR) + + answers = model.prompt( + images=image, + prompt="Which side of the image is red? Answer with 'left' or 'right'.", + max_new_tokens=64, + ) + + assert len(answers) == 1 + assert isinstance(answers[0], str) + assert len(answers[0].strip()) > 0 + + +@pytest.mark.slow +@pytest.mark.skipif( + not WORLD_PACKAGE_DIR or not CUDA_AVAILABLE, + reason="COSMOS3_WORLD_PACKAGE_DIR not set or CUDA unavailable", +) +def test_cosmos3_world_generates_video_from_image() -> None: + from inference_models.models.cosmos3.cosmos3_world import Cosmos3EdgeWorldModel + + model = Cosmos3EdgeWorldModel.from_pretrained( + WORLD_PACKAGE_DIR, device=torch.device("cuda") + ) + conditioning = np.full((240, 416, 3), 128, dtype=np.uint8) + + rollout = model.generate_video( + images=conditioning, + prompt="static gray scene", + num_frames=5, + fps=24, + resolution=240, + seed=0, + num_inference_steps=10, + ) + + assert len(rollout.frames) >= 1 + assert rollout.frames[0].ndim == 3 + assert rollout.frames[0].shape[2] == 3 + assert rollout.frames[0].dtype == np.uint8 + + +@pytest.mark.slow +@pytest.mark.skipif( + not WORLD_PACKAGE_DIR or not CUDA_AVAILABLE, + reason="COSMOS3_WORLD_PACKAGE_DIR not set or CUDA unavailable", +) +def test_cosmos3_world_forward_dynamics_threads_session() -> None: + from inference_models.models.cosmos3.cosmos3_world import ( + Cosmos3ActionTrajectory, + Cosmos3EdgeWorldModel, + ) + + model = Cosmos3EdgeWorldModel.from_pretrained( + WORLD_PACKAGE_DIR, device=torch.device("cuda") + ) + first_frame = np.full((256, 256, 3), 128, dtype=np.uint8) + actions = Cosmos3ActionTrajectory( + actions=np.zeros((8, 10), dtype=np.float32), + action_space="umi", + fps=20.0, + ) + + state = model.start_rollout(frames=[first_frame], resolution_tier=256) + rollout = model.forward_dynamics( + actions=actions, state_dict=state, num_inference_steps=10 + ) + + assert len(rollout.frames) >= 1 + assert rollout.state_dict is not None + # the returned state must be usable for the next chunk + second = model.forward_dynamics( + actions=actions, state_dict=rollout.state_dict, num_inference_steps=10 + ) + assert len(second.frames) >= 1 diff --git a/inference_models/tests/unit_tests/models/test_cosmos3_reasoner_hf.py b/inference_models/tests/unit_tests/models/test_cosmos3_reasoner_hf.py new file mode 100644 index 0000000000..bb99599e45 --- /dev/null +++ b/inference_models/tests/unit_tests/models/test_cosmos3_reasoner_hf.py @@ -0,0 +1,151 @@ +from unittest.mock import MagicMock + +import numpy as np +import torch + +from inference_models.configuration import ( + INFERENCE_MODELS_COSMOS3_DEFAULT_MAX_NEW_TOKENS, +) +from inference_models.models.cosmos3.cosmos3_reasoner_hf import Cosmos3EdgeReasoner + + +def _model_with_processor() -> Cosmos3EdgeReasoner: + model = MagicMock() + model.parameters.return_value = iter([torch.tensor(0.0, dtype=torch.bfloat16)]) + processor = MagicMock() + processor.apply_chat_template.return_value = "templated" + processor.return_value = { + "input_ids": torch.tensor([[1, 2, 3]], dtype=torch.int64), + "pixel_values": torch.zeros((1, 3, 8, 8), dtype=torch.float32), + } + return Cosmos3EdgeReasoner( + model=model, processor=processor, device=torch.device("cpu") + ) + + +def test_generate_returns_only_new_tokens() -> None: + reasoner = _model_with_processor() + reasoner._model.generate.return_value = torch.tensor([[1, 2, 21, 22]]) + + result = reasoner.generate(inputs={"input_ids": torch.tensor([[1, 2]])}) + + assert result.tolist() == [[21, 22]] + + +def test_pre_process_generation_builds_system_and_user_turns() -> None: + reasoner = _model_with_processor() + + inputs = reasoner.pre_process_generation( + images=np.zeros((8, 8, 3), dtype=np.uint8), + prompt="What is happening?Be terse.", + ) + + conversation = reasoner._processor.apply_chat_template.call_args.args[0] + assert conversation[0]["role"] == "system" + assert conversation[0]["content"][0]["text"] == "Be terse." + assert conversation[1]["content"][1]["text"] == "What is happening?" + assert "input_ids" in inputs and "pixel_values" in inputs + + +def test_pre_process_generation_uses_defaults_without_prompt() -> None: + reasoner = _model_with_processor() + + reasoner.pre_process_generation(images=np.zeros((8, 8, 3), dtype=np.uint8)) + + conversation = reasoner._processor.apply_chat_template.call_args.args[0] + assert conversation[0]["content"][0]["text"] == reasoner.default_system_prompt + assert conversation[1]["content"][1]["text"] == "Describe what's in this image." + + +def test_pre_process_generation_video_path_passes_frames_as_video() -> None: + reasoner = _model_with_processor() + frames = [np.zeros((8, 8, 3), dtype=np.uint8) for _ in range(4)] + + reasoner.pre_process_generation(images=frames, as_video=True) + + conversation = reasoner._processor.apply_chat_template.call_args.args[0] + assert conversation[1]["content"][0]["type"] == "video" + assert "videos" in reasoner._processor.call_args.kwargs + assert len(reasoner._processor.call_args.kwargs["videos"][0]) == 4 + + +def test_pre_process_generation_casts_floating_point_inputs_to_model_dtype() -> None: + reasoner = _model_with_processor() + + inputs = reasoner.pre_process_generation(images=np.zeros((8, 8, 3), dtype=np.uint8)) + + assert inputs["input_ids"].dtype == torch.int64 + assert inputs["pixel_values"].dtype == torch.bfloat16 + + +def test_generate_uses_default_max_new_tokens_when_none_is_given() -> None: + reasoner = _model_with_processor() + reasoner._model.generate.return_value = torch.tensor([[1, 2, 9]]) + + reasoner.generate(inputs={"input_ids": torch.tensor([[1, 2]])}, max_new_tokens=None) + + assert reasoner._model.generate.call_args.kwargs["max_new_tokens"] == ( + INFERENCE_MODELS_COSMOS3_DEFAULT_MAX_NEW_TOKENS + ) + + +def test_post_process_generation_strips_thinking_block_by_default() -> None: + reasoner = _model_with_processor() + reasoner._processor.batch_decode.return_value = [ + "The image is blue. So the answer is blue. blue" + ] + + result = reasoner.post_process_generation(generated_ids=torch.tensor([[1]])) + + assert result == ["blue"] + + +def test_post_process_generation_returns_thinking_when_requested() -> None: + reasoner = _model_with_processor() + reasoner._processor.batch_decode.return_value = [ + "The image is blue. So the answer is blue. blue" + ] + + result = reasoner.post_process_generation( + generated_ids=torch.tensor([[1]]), return_thinking=True + ) + + assert result == [ + { + "thinking": "The image is blue. So the answer is blue.", + "answer": "blue", + } + ] + + +def test_post_process_generation_handles_truncated_thinking() -> None: + reasoner = _model_with_processor() + reasoner._processor.batch_decode.return_value = ["Okay, the user wants"] + + result = reasoner.post_process_generation( + generated_ids=torch.tensor([[1]]), return_thinking=True + ) + + assert result == [{"thinking": "Okay, the user wants", "answer": ""}] + + +def test_post_process_generation_strips_assistant_prefix() -> None: + reasoner = _model_with_processor() + reasoner._processor.batch_decode.return_value = ["assistant\nThe box falls. "] + + result = reasoner.post_process_generation(generated_ids=torch.tensor([[1]])) + + assert result == ["The box falls."] + + +def test_prompt_video_returns_single_string() -> None: + reasoner = _model_with_processor() + reasoner._model.generate.return_value = torch.tensor([[1, 2, 3, 9]]) + reasoner._processor.batch_decode.return_value = ["a robot arm"] + + result = reasoner.prompt_video( + frames=[np.zeros((8, 8, 3), dtype=np.uint8)] * 2, + prompt="What will happen next?", + ) + + assert result == "a robot arm" diff --git a/inference_models/tests/unit_tests/models/test_cosmos3_world.py b/inference_models/tests/unit_tests/models/test_cosmos3_world.py new file mode 100644 index 0000000000..8242aa4fc6 --- /dev/null +++ b/inference_models/tests/unit_tests/models/test_cosmos3_world.py @@ -0,0 +1,115 @@ +from unittest.mock import MagicMock + +import numpy as np +import pytest +import torch + +from inference_models.errors import ModelInputError +from inference_models.models.cosmos3.cosmos3_world import ( + SESSION_KEY, + Cosmos3ActionTrajectory, + Cosmos3EdgeWorldModel, +) + + +def _world_model() -> Cosmos3EdgeWorldModel: + return Cosmos3EdgeWorldModel(runtime=MagicMock(), device=torch.device("cpu")) + + +def _rgb_frames(n: int) -> list: + return [np.full((4, 6, 3), 100, dtype=np.uint8) for _ in range(n)] + + +def test_generate_video_converts_output_to_bgr_and_reports_resolution() -> None: + model = _world_model() + rgb = np.zeros((4, 6, 3), dtype=np.uint8) + rgb[..., 0] = 255 # pure red in RGB + model._runtime.generate_video.return_value = [rgb, rgb] + + rollout = model.generate_video( + images=np.zeros((4, 6, 3), dtype=np.uint8), num_frames=2, fps=24 + ) + + assert len(rollout.frames) == 2 + assert rollout.frames[0][0, 0].tolist() == [0, 0, 255] # red lands in BGR[2] + assert rollout.resolution == (6, 4) + assert rollout.fps == 24.0 + assert rollout.state_dict is None + + +def test_generate_video_converts_bgr_input_to_rgb_for_runtime() -> None: + model = _world_model() + model._runtime.generate_video.return_value = [] + bgr = np.zeros((4, 6, 3), dtype=np.uint8) + bgr[..., 0] = 255 # pure blue in BGR + + model.generate_video(images=bgr) + + sent = model._runtime.generate_video.call_args.kwargs["images"][0] + assert sent[0, 0].tolist() == [0, 0, 255] # blue lands in RGB[2] + + +def test_forward_dynamics_without_session_raises() -> None: + model = _world_model() + trajectory = Cosmos3ActionTrajectory( + actions=np.zeros((5, 7)), action_space="droid_joint_velocity", fps=15.0 + ) + + with pytest.raises(ModelInputError): + model.forward_dynamics(actions=trajectory, state_dict={}) + with pytest.raises(ModelInputError): + model.forward_dynamics(actions=trajectory, state_dict=None) + + +def test_forward_dynamics_threads_session_state() -> None: + model = _world_model() + model._runtime.encode_context.return_value = "session-0" + model._runtime.rollout.return_value = (_rgb_frames(5), "session-1") + trajectory = Cosmos3ActionTrajectory( + actions=np.zeros((5, 7)), action_space="droid_joint_velocity", fps=15.0 + ) + + state = model.start_rollout(frames=_rgb_frames(2)) + rollout = model.forward_dynamics(actions=trajectory, state_dict=state) + + assert state == {SESSION_KEY: "session-0"} + assert model._runtime.rollout.call_args.kwargs["session"] == "session-0" + assert model._runtime.rollout.call_args.kwargs["num_frames"] == 5 + assert ( + model._runtime.rollout.call_args.kwargs["action_space"] + == "droid_joint_velocity" + ) + assert rollout.state_dict == {SESSION_KEY: "session-1"} + assert len(rollout.frames) == 5 + assert rollout.fps == 15.0 + + +def test_start_rollout_requires_frames() -> None: + model = _world_model() + + with pytest.raises(ModelInputError): + model.start_rollout(frames=[]) + + +def test_inverse_dynamics_wraps_runtime_result() -> None: + model = _world_model() + model._runtime.infer_actions.return_value = { + "actions": [[0.1] * 7] * 3, + "action_space": "droid_joint_velocity", + "fps": 15, + "metadata": {"source": "test"}, + } + + trajectory = model.inverse_dynamics( + frames=_rgb_frames(3), action_space="droid_joint_velocity" + ) + + assert ( + model._runtime.infer_actions.call_args.kwargs["action_space"] + == "droid_joint_velocity" + ) + + assert trajectory.actions.shape == (3, 7) + assert trajectory.action_space == "droid_joint_velocity" + assert trajectory.fps == 15.0 + assert trajectory.metadata == {"source": "test"} diff --git a/inference_models/uv.lock b/inference_models/uv.lock index 3a27640102..77fc081d77 100644 --- a/inference_models/uv.lock +++ b/inference_models/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 2 requires-python = ">=3.10, <3.13" resolution-markers = [ "python_full_version >= '3.12' and platform_machine != 's390x' and sys_platform == 'darwin'", @@ -139,7 +139,7 @@ name = "anyio" version = "4.12.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "exceptiongroup", marker = "python_full_version < '3.11' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, + { name = "exceptiongroup", marker = "python_full_version < '3.11' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126')" }, { name = "idna" }, { name = "typing-extensions" }, ] @@ -390,7 +390,7 @@ name = "click" version = "8.3.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "sys_platform == 'win32' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, + { name = "colorama", marker = "sys_platform == 'win32' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126')" }, ] sdist = { url = "https://files.pythonhosted.org/packages/3d/fa/656b739db8587d7b5dfa22e22ed02566950fbfbcdc20311993483657a5c0/click-8.3.1.tar.gz", hash = "sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a", size = 295065, upload-time = "2025-11-15T20:45:42.706Z" } wheels = [ @@ -411,7 +411,7 @@ name = "coloredlogs" version = "15.0.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "humanfriendly", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126') or extra == 'extra-16-inference-models-onnx-cpu' or extra == 'extra-16-inference-models-onnx-cu118' or extra == 'extra-16-inference-models-onnx-cu12' or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, + { name = "humanfriendly", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (platform_machine != 'aarch64' and extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (sys_platform != 'linux' and extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, ] sdist = { url = "https://files.pythonhosted.org/packages/cc/c7/eed8f27100517e8c0e6b923d5f0845d0cb99763da6fdee00478f91db7325/coloredlogs-15.0.1.tar.gz", hash = "sha256:7c991aa71a4577af2f82600d8f8f3a89f936baeaf9b50a9c197da014e5bf16b0", size = 278520, upload-time = "2021-06-11T10:22:45.202Z" } wheels = [ @@ -590,7 +590,7 @@ name = "exceptiongroup" version = "1.3.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "typing-extensions", marker = "python_full_version < '3.11' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, + { name = "typing-extensions", marker = "python_full_version < '3.11' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126')" }, ] sdist = { url = "https://files.pythonhosted.org/packages/0b/9f/a65090624ecf468cdca03533906e7c69ed7588582240cfe7cc9e770b50eb/exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88", size = 29749, upload-time = "2025-05-10T17:42:51.123Z" } wheels = [ @@ -829,7 +829,7 @@ source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "filelock" }, { name = "fsspec" }, - { name = "hf-xet", marker = "platform_machine == 'AMD64' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, + { name = "hf-xet", marker = "platform_machine == 'AMD64' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126')" }, { name = "httpx" }, { name = "packaging" }, { name = "pyyaml" }, @@ -1896,7 +1896,7 @@ resolution-markers = [ "(python_full_version < '3.11' and platform_machine != 'aarch64' and platform_machine != 's390x' and sys_platform == 'linux') or (python_full_version < '3.11' and platform_machine != 's390x' and sys_platform != 'darwin' and sys_platform != 'linux')", ] dependencies = [ - { name = "numpy", marker = "platform_machine != 's390x' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, + { name = "numpy", marker = "platform_machine != 's390x' or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, ] sdist = { url = "https://files.pythonhosted.org/packages/32/49/6e67c334872d2c114df3020e579f3718c333198f8312290e09ec0216703a/ml_dtypes-0.5.1.tar.gz", hash = "sha256:ac5b58559bb84a95848ed6984eb8013249f90b6bab62aa5acbad876e256002c9", size = 698772, upload-time = "2025-01-07T03:34:55.613Z" } wheels = [ @@ -1927,7 +1927,7 @@ resolution-markers = [ "python_full_version < '3.11' and platform_machine == 's390x' and sys_platform != 'darwin'", ] dependencies = [ - { name = "numpy", marker = "platform_machine == 's390x' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, + { name = "numpy", marker = "platform_machine == 's390x' or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, ] sdist = { url = "https://files.pythonhosted.org/packages/0e/4a/c27b42ed9b1c7d13d9ba8b6905dece787d6259152f2309338aed29b2447b/ml_dtypes-0.5.4.tar.gz", hash = "sha256:8ab06a50fb9bf9666dd0fe5dfb4676fa2b0ac0f31ecff72a6c3af8e22c063453", size = 692314, upload-time = "2025-11-17T22:32:31.031Z" } wheels = [ @@ -3032,6 +3032,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/bc/60/5382c03e1970de634027cee8e1b7d39776b778b81812aaf45b694dfe9e28/pillow-12.2.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:bfa9c230d2fe991bed5318a5f119bd6780cda2915cca595393649fc118ab895e", size = 7080946, upload-time = "2026-04-01T14:46:11.734Z" }, ] +[[package]] +name = "pkgconfig" +version = "1.6.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/52/fd/0adde075cd3bfecd557bc7d757e00e231d34d8a6edb4c8d1642759254c21/pkgconfig-1.6.0.tar.gz", hash = "sha256:4a5a6631ce937fafac457104a40d558785a658bbdca5c49b6295bc3fd651907f", size = 5691, upload-time = "2026-03-06T11:26:01.194Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/75/6f/f7ec07fba48f07c555cc4099481df644fbbc12067879072c17ac229f6556/pkgconfig-1.6.0-py3-none-any.whl", hash = "sha256:98e71754855e9563838d952a160eb577edabb57782e49853edb5381927e6bea1", size = 7086, upload-time = "2026-03-06T11:26:07.688Z" }, +] + [[package]] name = "platformdirs" version = "4.3.8" @@ -3055,7 +3064,7 @@ name = "portalocker" version = "3.2.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "pywin32", marker = "sys_platform == 'win32' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, + { name = "pywin32", marker = "sys_platform == 'win32' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126')" }, ] sdist = { url = "https://files.pythonhosted.org/packages/5e/77/65b857a69ed876e1951e88aaba60f5ce6120c33703f7cb61a3c894b8c1b6/portalocker-3.2.0.tar.gz", hash = "sha256:1f3002956a54a8c3730586c5c77bf18fae4149e07eaf1c29fc3faf4d5a3f89ac", size = 95644, upload-time = "2025-06-14T13:20:40.03Z" } wheels = [ @@ -3539,6 +3548,7 @@ version = "2.2.3" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "cffi" }, + { name = "pkgconfig" }, ] sdist = { url = "https://files.pythonhosted.org/packages/7b/88/f73dae807ec68b228fba72507105e3ba80a561dc0bade0004ce24fd118fc/pyvips-2.2.3.tar.gz", hash = "sha256:43bceced0db492654c93008246a58a508e0373ae1621116b87b322f2ac72212f", size = 56626, upload-time = "2024-04-28T11:19:58.158Z" } @@ -4560,9 +4570,9 @@ resolution-markers = [ "python_full_version < '3.11' and platform_machine == 's390x' and sys_platform != 'darwin'", ] dependencies = [ - { name = "huggingface-hub", marker = "sys_platform != 'darwin' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, - { name = "pyyaml", marker = "sys_platform != 'darwin' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, - { name = "safetensors", marker = "sys_platform != 'darwin' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, + { name = "huggingface-hub", marker = "sys_platform != 'darwin' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126')" }, + { name = "pyyaml", marker = "sys_platform != 'darwin' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126')" }, + { name = "safetensors", marker = "sys_platform != 'darwin' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126')" }, { name = "torch", version = "2.6.0+cu124", source = { registry = "https://download.pytorch.org/whl/cu124" }, marker = "(sys_platform != 'darwin' and extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra != 'extra-16-inference-models-torch-cpu' and extra != 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (sys_platform != 'darwin' and extra != 'extra-16-inference-models-onnx-cpu' and extra != 'extra-16-inference-models-onnx-cu118' and extra != 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, { name = "torch", version = "2.7.1+cpu", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "(sys_platform != 'darwin' and extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra == 'extra-16-inference-models-torch-cpu') or (sys_platform != 'darwin' and extra != 'extra-16-inference-models-onnx-cpu' and extra != 'extra-16-inference-models-onnx-cu118' and extra != 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-torch-cpu') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, { name = "torch", version = "2.7.1+cu118", source = { registry = "https://download.pytorch.org/whl/cu118" }, marker = "(sys_platform != 'darwin' and extra != 'extra-16-inference-models-onnx-jp6-cu126' and extra != 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (sys_platform != 'darwin' and extra != 'extra-16-inference-models-onnx-cpu' and extra != 'extra-16-inference-models-onnx-cu118' and extra != 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, @@ -5251,7 +5261,7 @@ name = "tqdm" version = "4.67.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "sys_platform == 'win32' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu118') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cpu' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu124') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu118' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu126') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu124' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu128') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu126' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-cu130') or (extra == 'extra-16-inference-models-torch-cu128' and extra == 'extra-16-inference-models-torch-jp6-cu126') or (extra == 'extra-16-inference-models-torch-cu130' and extra == 'extra-16-inference-models-torch-jp6-cu126')" }, + { name = "colorama", marker = "sys_platform == 'win32' or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu118') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cpu' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-cu12') or (extra == 'extra-16-inference-models-onnx-cu118' and extra == 'extra-16-inference-models-onnx-jp6-cu126') or (extra == 'extra-16-inference-models-onnx-cu12' and extra == 'extra-16-inference-models-onnx-jp6-cu126')" }, ] sdist = { url = "https://files.pythonhosted.org/packages/a8/4b/29b4ef32e036bb34e4ab51796dd745cdba7ed47ad142a9f4a1eb8e0c744d/tqdm-4.67.1.tar.gz", hash = "sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2", size = 169737, upload-time = "2024-11-24T20:12:22.481Z" } wheels = [ diff --git a/requirements/requirements.cosmos.txt b/requirements/requirements.cosmos.txt new file mode 100644 index 0000000000..51164a4116 --- /dev/null +++ b/requirements/requirements.cosmos.txt @@ -0,0 +1,13 @@ +# Optional dependencies for NVIDIA Cosmos 3 Edge (reasoner + generator). +# +# Cosmos 3 support is newer than any transformers/diffusers release: +# - transformers: `cosmos3_edge` model type requires >=5.15 (unreleased) +# - diffusers: Cosmos3OmniPipeline checkpoint format requires >=0.40 (unreleased; +# 0.39.0 loads the transformer with meta/randomly-initialized tensors) +# +# Until those releases land we pin the exact git commits validated on real +# weights (L4, 2026-07-20). Replace with pypi version pins once released -- +# git direct-URL deps cannot ship in the pypi extras (see .release/pypi/*.setup.py), +# so this file is intentionally NOT wired into extras_require yet. +transformers @ git+https://github.com/huggingface/transformers.git@cbf4d720ec734edb77d25452b2790c7e4be2f8d7 +diffusers @ git+https://github.com/huggingface/diffusers.git@86e6dac5360703ddf09fe250db50be667eb93662 diff --git a/requirements/requirements.cpu.txt b/requirements/requirements.cpu.txt index 78a211734c..2fe3ce4eaf 100644 --- a/requirements/requirements.cpu.txt +++ b/requirements/requirements.cpu.txt @@ -1,3 +1,3 @@ onnxruntime>=1.15.1,<1.22.0 nvidia-ml-py<13.0.0 -inference-models[torch-cpu,onnx-cpu]~=0.32.0rc3 # keep in sync between requirements.gpu.txt, requirements.cpu.txt, requirements.vino.txt +inference-models[torch-cpu,onnx-cpu]~=0.32.0 # keep in sync between requirements.gpu.txt, requirements.cpu.txt, requirements.vino.txt diff --git a/requirements/requirements.gpu.txt b/requirements/requirements.gpu.txt index 6e5bd7c61b..4f89ab253b 100644 --- a/requirements/requirements.gpu.txt +++ b/requirements/requirements.gpu.txt @@ -1,2 +1,2 @@ onnxruntime-gpu>=1.15.1,<1.22.0 -inference-models[torch-cu124,onnx-cu12]~=0.32.0rc3 # keep in sync between requirements.jetson requirements.gpu.txt, requirements.cpu.txt, requirements.vino.txt +inference-models[torch-cu124,onnx-cu12]~=0.32.0 # keep in sync between requirements.jetson requirements.gpu.txt, requirements.cpu.txt, requirements.vino.txt diff --git a/requirements/requirements.jetson.txt b/requirements/requirements.jetson.txt index f94a3d7e03..5c4a0f96ca 100644 --- a/requirements/requirements.jetson.txt +++ b/requirements/requirements.jetson.txt @@ -1,3 +1,3 @@ pypdfium2>=4.11.0,<5.0.0 PyYAML~=6.0.0 -inference-models~=0.32.0rc3 # keep in sync between requirements.jetson requirements.gpu.txt, requirements.cpu.txt, requirements.vino.txt +inference-models~=0.32.0 # keep in sync between requirements.jetson requirements.gpu.txt, requirements.cpu.txt, requirements.vino.txt diff --git a/requirements/requirements.vino.txt b/requirements/requirements.vino.txt index fc2e6bcdf6..190ca0127e 100644 --- a/requirements/requirements.vino.txt +++ b/requirements/requirements.vino.txt @@ -1,2 +1,2 @@ onnxruntime-openvino>=1.15.0,<1.22.0 -inference-models[torch-cpu]~=0.32.0rc3 # keep in sync between requirements.jetson requirements.gpu.txt, requirements.cpu.txt, requirements.vino.txt +inference-models[torch-cpu]~=0.32.0 # keep in sync between requirements.jetson requirements.gpu.txt, requirements.cpu.txt, requirements.vino.txt diff --git a/tests/workflows/unit_tests/core_steps/models/foundation/test_cosmos3.py b/tests/workflows/unit_tests/core_steps/models/foundation/test_cosmos3.py new file mode 100644 index 0000000000..1a8e5ac4e9 --- /dev/null +++ b/tests/workflows/unit_tests/core_steps/models/foundation/test_cosmos3.py @@ -0,0 +1,71 @@ +"""Unit tests for the Cosmos 3 Edge v1 block manifest.""" + +import pytest +from pydantic import ValidationError + +from inference.core.workflows.core_steps.models.foundation.cosmos3.v1 import ( + BlockManifest, + _combine_prompt, +) + +BASE = { + "type": "roboflow_core/cosmos3_edge@v1", + "name": "my_cosmos_step", + "images": "$inputs.image", +} + + +def test_manifest_parses_with_defaults(): + result = BlockManifest.model_validate(BASE) + assert result.prompt is None + assert result.system_prompt is None + assert result.model_version == "nvidia/cosmos-3-edge" + + +def test_manifest_accepts_literal_prompts(): + result = BlockManifest.model_validate( + {**BASE, "prompt": "Is the path clear?", "system_prompt": "Be terse."} + ) + assert result.prompt == "Is the path clear?" + assert result.system_prompt == "Be terse." + + +def test_manifest_accepts_input_selector_prompts(): + result = BlockManifest.model_validate( + { + **BASE, + "prompt": "$inputs.prompt", + "system_prompt": "$inputs.system_prompt", + } + ) + assert result.prompt == "$inputs.prompt" + assert result.system_prompt == "$inputs.system_prompt" + + +def test_manifest_accepts_model_version_selector(): + result = BlockManifest.model_validate( + {**BASE, "model_version": "$inputs.model_version"} + ) + assert result.model_version == "$inputs.model_version" + + +def test_manifest_rejects_invalid_image_selector(): + with pytest.raises(ValidationError): + BlockManifest.model_validate({**BASE, "images": 42}) + + +def test_manifest_declares_single_output(): + outputs = BlockManifest.describe_outputs() + assert [o.name for o in outputs] == ["output"] + + +def test_combine_prompt_uses_sentinel(): + assert ( + _combine_prompt(prompt="Question?", system_prompt="Context.") + == "Question?Context." + ) + + +def test_combine_prompt_applies_defaults(): + combined = _combine_prompt(prompt=None, system_prompt=None) + assert combined.startswith("Describe what's in this image.")