---
title: hyworld
---

<div class="python-reference">
<a id="fastvideo.models.dits.hyworld-classes"></a>
<a id="fastvideo.models.dits.hyworld-functions"></a>
<a id="fastvideo.models.dits.hyworld.HYWorldDoubleStreamBlock-functions"></a>
<a id="fastvideo.models.dits.hyworld.HYWorldTransformer3DModel-functions"></a>
<a id="fastvideo.models.dits.hyworld"></a>
<p>HYWorld (HY-WorldPlay) model components for FastVideo.</p>
<p>This module provides:
- HYWorldTransformer3DModel: The main transformer model with ProPE and action conditioning
- HYWorldVideoGenerator: Extended VideoGenerator for HYWorld inference
- Utilities for pose processing and camera trajectory generation</p>
<h2 id="fastvideo.models.dits.hyworld.HYWorldTransformer3DModel"><code>fastvideo.models.dits.hyworld.HYWorldTransformer3DModel</code></h2>
<pre class="doc-signature"><code>HYWorldTransformer3DModel(config: HYWorldConfig, hf_config: dict&#91;str, Any&#93;)</code></pre>
<p>HY-World Transformer extending HunyuanVideo15 with:
- ProPE (Projective Positional Encoding) for camera-aware attention
- Action conditioning for interactive video generation</p>

<h3 id="fastvideo.models.dits.hyworld.HYWorldTransformer3DModel.forward"><code>fastvideo.models.dits.hyworld.HYWorldTransformer3DModel.forward</code></h3>
<pre class="doc-signature"><code>forward(hidden_states: torch.Tensor, encoder_hidden_states: list&#91;torch.Tensor&#93;, timestep: torch.LongTensor, encoder_hidden_states_image: list&#91;torch.Tensor&#93;, encoder_attention_mask: list&#91;torch.Tensor&#93;, action: torch.Tensor, viewmats: torch.Tensor, Ks: torch.Tensor, timestep_txt: torch.LongTensor, guidance: Optional&#91;torch.Tensor&#93; = None, timestep_r: Optional&#91;torch.LongTensor&#93; = None, attention_kwargs: Optional&#91;dict&#91;str, Any&#93;&#93; = None)</code></pre>
<p>Forward pass with action and camera conditioning.</p>
<h4>Parameters</h4>
<dl>
<dt><code>action: torch.Tensor</code></dt><dd><p>Action tensor for action conditioning [B, T] or [B*T]</p></dd>
<dt><code>viewmats: torch.Tensor</code></dt><dd><p>Camera view matrices [B, T, 4, 4]</p></dd>
<dt><code>Ks: torch.Tensor</code></dt><dd><p>Camera intrinsics [B, T, 3, 3]</p></dd>
</dl>
<h2 id="fastvideo.models.dits.hyworld.HYWorldDoubleStreamBlock"><code>fastvideo.models.dits.hyworld.HYWorldDoubleStreamBlock</code></h2>
<pre class="doc-signature"><code>HYWorldDoubleStreamBlock(hidden_size: int, num_attention_heads: int, mlp_ratio: float, dtype: torch.dtype | None = None, supported_attention_backends: tuple&#91;AttentionBackendEnum, ...&#93; | None = None, prefix: str = &#x27;&#x27;)</code></pre>
<p>Extended MMDoubleStreamBlock with ProPE (Projective Positional Encoding) support
for camera-aware attention in HY-World/WorldPlay models.</p>

<h3 id="fastvideo.models.dits.hyworld.HYWorldDoubleStreamBlock.forward"><code>fastvideo.models.dits.hyworld.HYWorldDoubleStreamBlock.forward</code></h3>
<pre class="doc-signature"><code>forward(img: torch.Tensor, txt: torch.Tensor, encoder_attention_mask: torch.Tensor, vec: torch.Tensor, vec_txt: torch.Tensor, freqs_cis: tuple, original_seq_len: int, viewmats: torch.Tensor, Ks: torch.Tensor) -&gt; tuple&#91;torch.Tensor, torch.Tensor&#93;</code></pre>
<p>Forward pass with ProPE camera conditioning.</p>
<h4>Parameters</h4>
<dl>
<dt><code>img: torch.Tensor</code></dt><dd><p>Image/video tokens</p></dd>
<dt><code>txt: torch.Tensor</code></dt><dd><p>Text tokens</p></dd>
<dt><code>encoder_attention_mask: torch.Tensor</code></dt><dd><p>Text attention mask</p></dd>
<dt><code>vec: torch.Tensor</code></dt><dd><p>Modulation vector</p></dd>
<dt><code>freqs_cis: tuple</code></dt><dd><p>Rotary embedding frequencies</p></dd>
<dt><code>original_seq_len: int</code></dt><dd><p>Original (unpadded) image sequence length</p></dd>
<dt><code>viewmats: torch.Tensor</code></dt><dd><p>Camera view matrices for ProPE [B, T, 4, 4]</p></dd>
<dt><code>Ks: torch.Tensor</code></dt><dd><p>Camera intrinsics for ProPE [B, T, 3, 3]</p></dd>
</dl>
<h4>Returns</h4>
<dl>
<dt><code>tuple[torch.Tensor, torch.Tensor]</code></dt><dd><p>Tuple of (img, txt) output tokens</p></dd>
</dl>
<h2 id="fastvideo.models.dits.hyworld.get_resolution_from_image"><code>fastvideo.models.dits.hyworld.get_resolution_from_image</code></h2>
<pre class="doc-signature"><code>get_resolution_from_image(image_path, target_resolution = &#x27;480p&#x27;)</code></pre>
<p>Automatically determine resolution from input image.</p>
<h3>Parameters</h3>
<dl>
<dt><code>image_path</code></dt><dd><p>Path or URL to input image</p></dd>
<dt><code>target_resolution</code></dt><dd><p>Target resolution tier ("480p", "720p", etc.)</p></dd>
</dl>
<h3>Returns</h3>
<dl>
<dt><code></code></dt><dd><p>tuple[int, int]: (height, width) matching HY-WorldPlay's bucket selection</p></dd>
</dl>
</div>

<h2>Submodules</h2>
<ul>
<li><a href="/FastVideo/api/fastvideo/models/dits/hyworld/camera_rope">camera_rope</a></li>
<li><a href="/FastVideo/api/fastvideo/models/dits/hyworld/data_utils">data_utils</a></li>
<li><a href="/FastVideo/api/fastvideo/models/dits/hyworld/hyworld">hyworld</a></li>
<li><a href="/FastVideo/api/fastvideo/models/dits/hyworld/pose">pose</a></li>
<li><a href="/FastVideo/api/fastvideo/models/dits/hyworld/resolution_utils">resolution_utils</a></li>
<li><a href="/FastVideo/api/fastvideo/models/dits/hyworld/retrieval_context">retrieval_context</a></li>
<li><a href="/FastVideo/api/fastvideo/models/dits/hyworld/trajectory">trajectory</a></li>
</ul>
