Text-to-Image
Cosmos
Diffusers
Safetensors
cosmos3_omni
nvidia
cosmos3
vllm-omni
sglang
sglang-diffusion
image-generation
Instructions to use nvidia/Cosmos3-Super-Text2Image with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Cosmos
How to use nvidia/Cosmos3-Super-Text2Image with Cosmos:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Diffusers
How to use nvidia/Cosmos3-Super-Text2Image with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("nvidia/Cosmos3-Super-Text2Image", torch_dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Commit ·
9ae57c4
1
Parent(s): 9d3c345
Let callers set the critic's request parameters
Browse filesVLMQualityJudge built its chat-completions request with fixed parameters, so the
reasoning and sampling settings used for the critic could not be configured: callers
reproducing a specific evaluation setup had no way to pin e.g. reasoning_effort.
Add an extra_body passthrough (default None, so the request is unchanged unless a
caller sets it) and raise the critic's max_tokens default to 16384. With reasoning
models the thinking tokens come out of the same budget (measured up to ~6.7k tokens
for gemini-3.1-pro at reasoning_effort=high), which leaves little headroom under 8192
for the analysis JSON itself.
agentic_upsampling/clients.py
CHANGED
|
@@ -477,8 +477,9 @@ class VLMQualityJudge:
|
|
| 477 |
api_token: str,
|
| 478 |
endpoint_url: str = DEFAULT_CRITIC_ENDPOINT_URL,
|
| 479 |
model: str = DEFAULT_CRITIC_MODEL,
|
| 480 |
-
max_tokens: int =
|
| 481 |
image_jpeg_quality: int | None = DEFAULT_JPEG_QUALITY,
|
|
|
|
| 482 |
) -> None:
|
| 483 |
self.chat_client = OpenAIChatClient(
|
| 484 |
ChatClientConfig(
|
|
@@ -487,6 +488,7 @@ class VLMQualityJudge:
|
|
| 487 |
api_token=api_token,
|
| 488 |
max_tokens=max_tokens,
|
| 489 |
max_retries=3,
|
|
|
|
| 490 |
)
|
| 491 |
)
|
| 492 |
self.image_jpeg_quality = image_jpeg_quality
|
|
|
|
| 477 |
api_token: str,
|
| 478 |
endpoint_url: str = DEFAULT_CRITIC_ENDPOINT_URL,
|
| 479 |
model: str = DEFAULT_CRITIC_MODEL,
|
| 480 |
+
max_tokens: int = 16384,
|
| 481 |
image_jpeg_quality: int | None = DEFAULT_JPEG_QUALITY,
|
| 482 |
+
extra_body: dict[str, Any] | None = None,
|
| 483 |
) -> None:
|
| 484 |
self.chat_client = OpenAIChatClient(
|
| 485 |
ChatClientConfig(
|
|
|
|
| 488 |
api_token=api_token,
|
| 489 |
max_tokens=max_tokens,
|
| 490 |
max_retries=3,
|
| 491 |
+
extra_body=extra_body,
|
| 492 |
)
|
| 493 |
)
|
| 494 |
self.image_jpeg_quality = image_jpeg_quality
|
tests/test_agentic_upsampling.py
CHANGED
|
@@ -10,7 +10,7 @@ from typing import Any
|
|
| 10 |
|
| 11 |
from PIL import Image
|
| 12 |
|
| 13 |
-
from agentic_upsampling.clients import ImageGenerationClient, PromptRewriterClient
|
| 14 |
from agentic_upsampling.constants import (
|
| 15 |
DEFAULT_CRITIC_ENDPOINT_URL,
|
| 16 |
DEFAULT_CRITIC_MODEL,
|
|
@@ -521,3 +521,14 @@ def test_extract_best_images_copies_images_and_writes_manifests(tmp_path: Path)
|
|
| 521 |
assert (tmp_path / "export" / "best_generations.jsonl").exists()
|
| 522 |
assert (tmp_path / "export" / "best_generations.csv").exists()
|
| 523 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
from PIL import Image
|
| 12 |
|
| 13 |
+
from agentic_upsampling.clients import ImageGenerationClient, PromptRewriterClient, VLMQualityJudge
|
| 14 |
from agentic_upsampling.constants import (
|
| 15 |
DEFAULT_CRITIC_ENDPOINT_URL,
|
| 16 |
DEFAULT_CRITIC_MODEL,
|
|
|
|
| 521 |
assert (tmp_path / "export" / "best_generations.jsonl").exists()
|
| 522 |
assert (tmp_path / "export" / "best_generations.csv").exists()
|
| 523 |
|
| 524 |
+
|
| 525 |
+
def test_vlm_quality_judge_sends_no_extra_body_by_default() -> None:
|
| 526 |
+
judge = VLMQualityJudge(api_token="token")
|
| 527 |
+
|
| 528 |
+
assert judge.chat_client.config.extra_body is None
|
| 529 |
+
|
| 530 |
+
|
| 531 |
+
def test_vlm_quality_judge_forwards_extra_body() -> None:
|
| 532 |
+
judge = VLMQualityJudge(api_token="token", extra_body={"reasoning_effort": "high"})
|
| 533 |
+
|
| 534 |
+
assert judge.chat_client.config.extra_body == {"reasoning_effort": "high"}
|