Files

88 lines
2.9 KiB
Markdown
Raw Permalink Normal View History

---
license: other
license_name: nvidia-open-model-license
license_link: https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license
library_name: transformers
pipeline_tag: text-generation
base_model: nvidia/Cosmos-Reason2-2B
tags:
- transformers
- safetensors
- qwen3
- cosmos
- nvidia
- text-generation
- text-only
---
# Cosmos-Reason2-2B Text-Only
This is a text-only extraction of [`nvidia/Cosmos-Reason2-2B`](https://huggingface.co/nvidia/Cosmos-Reason2-2B).
Built on NVIDIA Cosmos.
The original model is a Qwen3-VL/Cosmos vision-language model. This repository keeps the language backbone and `lm_head`, removes the vision tower and projector weights, and saves the result as a standalone Hugging Face `Qwen3ForCausalLM` checkpoint.
## What Changed
- Source model: `nvidia/Cosmos-Reason2-2B`
- Output architecture: `Qwen3ForCausalLM`
- Output `model_type`: `qwen3`
- Kept tensors: 311
- Dropped tensors: 315
- Removed weight prefixes include `model.visual.*` and other multimodal components
- Output weights: `model.safetensors`
The original nested text config used `qwen3_vl_text`. It was converted to a `qwen3` CausalLM-compatible config because the tested Transformers environment did not expose `qwen3_vl_text` through `AutoModelForCausalLM`.
## Validation
Validated locally with:
- `torch 2.12.1+cpu`
- `transformers 5.12.1`
- `safetensors 0.8.0`
Checks performed:
- `AutoConfig.from_pretrained(...)` loads as `Qwen3Config`
- `AutoTokenizer.from_pretrained(...)` loads as `Qwen2Tokenizer`
- `AutoModelForCausalLM.from_pretrained(...)` loads as `Qwen3ForCausalLM`
- Forward pass succeeds on a short text prompt
- Output logits shape: `(1, 7, 151936)`
- No `visual`, `vision`, `projector`, or `language_model` tensor names remain in the exported checkpoint
## Usage
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "sasa2000/cosmos-reason2-2b-text-only"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto",
)
inputs = tokenizer("Explain why objects fall toward Earth.", return_tensors="pt").to(model.device)
with torch.no_grad():
output_ids = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(output_ids[0], skip_special_tokens=True))
```
## Limitations
This checkpoint is text-only. It does not include the original vision tower, video/image processor, or multimodal projector weights. Image and video inputs are not supported.
This is an unofficial derived checkpoint and is not released by NVIDIA.
## License
The source model is released under the [NVIDIA Open Model License](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license). Use of this derived checkpoint must comply with the original model license and any applicable terms.
Licensed by NVIDIA Corporation under the NVIDIA Open Model License.