Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Pika H3 Flex","local":"pika-h3-flex","sections":[{"title":"Đang tải","local":"loading","sections":[{"title":"Tái sử dụng MiniMax-H3 đã được tải","local":"reusing-a-loaded-minimax-h3","sections":[],"depth":3}],"depth":2},{"title":"Điểm khác biệt so với MiniMax-H3","local":"what-differs-from-minimax-h3","sections":[],"depth":2},{"title":"Sinh","local":"generation","sections":[],"depth":2},{"title":"PikaH3FlexModularPipeline","local":"diffusers.PikaH3FlexModularPipeline","sections":[],"depth":2},{"title":"PikaH3FlexBlocks","local":"diffusers.PikaH3FlexBlocks","sections":[],"depth":2},{"title":"PikaH3FlexImageReference","local":"diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference","sections":[],"depth":2},{"title":"PikaH3FlexVideoReference","local":"diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference","sections":[],"depth":2},{"title":"PikaH3FlexAudioReference","local":"diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference","sections":[],"depth":2}],"depth":1}"/> | |
| <link href="/docs/diffusers/main/en/_app/immutable/entry/start.D3LnKZ4R.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/BF9UNEM9.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DPnyVmXs.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/entry/app.C0rBoMxR.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DSGUT_OW.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/C045MWWx.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DnVIJfC5.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/nodes/0.DTZsP_3B.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/IaDvMxLQ.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/nodes/225.C7fDjxOl.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/bKdwVYpU.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/D0iXbNom.js" rel="modulepreload"> | |
| <!--13wh65h--><meta name="hf:doc:metadata" content="{"title":"Pika H3 Flex","local":"pika-h3-flex","sections":[{"title":"Loading","local":"loading","sections":[{"title":"Reusing a loaded MiniMax-H3","local":"reusing-a-loaded-minimax-h3","sections":[],"depth":3}],"depth":2},{"title":"What differs from MiniMax-H3","local":"what-differs-from-minimax-h3","sections":[],"depth":2},{"title":"Generation","local":"generation","sections":[],"depth":2},{"title":"PikaH3FlexModularPipeline","local":"diffusers.PikaH3FlexModularPipeline","sections":[],"depth":2},{"title":"PikaH3FlexBlocks","local":"diffusers.PikaH3FlexBlocks","sections":[],"depth":2},{"title":"PikaH3FlexImageReference","local":"diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference","sections":[],"depth":2},{"title":"PikaH3FlexVideoReference","local":"diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference","sections":[],"depth":2},{"title":"PikaH3FlexAudioReference","local":"diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference","sections":[],"depth":2}],"depth":1}"/><!----> | |
| <link href="/docs/diffusers/main/en/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: inline-end; margin-inline-start: 10px; display: inline-flex; position: relative; z-index: 10;"><div dir="ltr" class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----></span> <span dir="auto">Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg><!----></button></div> <!--[-1--><!--]--></div><!----> <!--[0--><h1 class="relative group"><a id="pika-h3-flex" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pika-h3-flex"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Pika H3 Flex<!----></span></h1><!--]--><!----> <div class="flex flex-wrap space-x-1"><a href="https://huggingface.co/docs/diffusers/main/en/tutorials/using_peft_for_inference" target="_blank" rel="noopener"><img alt="LoRA" src="https://img.shields.io/badge/LoRA-d8b4fe?style=flat"/></a></div> <p><a href="https://huggingface.co/Pika-Labs/Pika-H3-Flex" rel="nofollow">Pika H3 Flex</a> là phiên bản huấn luyện sau (post-training) của Pika dựa trên <a href="./minimax_h3">MiniMax-H3</a>, biến nó thành bộ tạo video và âm thanh chỉ trong sáu bước. Mô hình giữ nguyên chuỗi đóng gói (packed sequence) của MiniMax-H3, bộ điều kiện Qwen3-VL và hai VAE, đồng thời thay đổi hai điểm: bộ lấy mẫu (sampler) là lịch trình sáu bước cố định, trong đó nhiễu lại (re-noise) dự đoán sạch tại mỗi bước thay vì cập nhật Euler, và trọng số là một cặp adapter LoRA rank-128 trên hai phân vùng transformer của MiniMax-H3. Video cùng bản nhạc nền stereo đồng bộ được tạo ra từ cùng sáu lần truyền thẳng (forward pass).</p> <p>Bản phát hành chính là các adapter: adapter FL2VA (<code>fl2va/adapter.safetensors</code>) điều khiển phân vùng <code>transformer/</code> cho điều kiện văn bản và khung đầu cuối, adapter Ref2VA (<code>ref2va/adapter.safetensors</code>) điều khiển <code>transformer_ref/</code> cho các tham chiếu đa phương thức. Các thành phần cơ sở là của <a href="https://huggingface.co/MiniMaxAI/MiniMax-H3" rel="nofollow">MiniMaxAI/MiniMax-H3</a>, không thay đổi, và kho lưu trữ chứa một bản sao của chúng để có thể tải độc lập.</p> <p>Pika H3 Flex được tích hợp dưới dạng các khối <a href="../../modular_diffusers/overview">Modular Diffusers</a> duy nhất, giống như MiniMax-H3: các khối và <a href="/docs/diffusers/main/vi/api/pipelines/pika_h3_flex#diffusers.PikaH3FlexModularPipeline">PikaH3FlexModularPipeline</a> của chúng là toàn bộ phần tích hợp, và không có nửa <code>DiffusionPipeline</code>.</p> <!--[1--><h2 class="relative group"><a id="loading" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#loading"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Đang tải<!----></span></h2><!--]--><!----> <p>Một pipeline được lắp ráp qua hai bước: các thành phần được nạp thông qua <code>modular_model_index.json</code> trong đó liệt kê các thành phần cơ sở của MiniMax-H3 và hai cấu hình scheduler, sau đó adapter của workflow được chọn sẽ được nạp đè lên bằng <a href="/docs/diffusers/main/vi/api/loaders/lora#diffusers.loaders.MiniMaxH3LoraLoaderMixin.load_lora_weights">load_lora_weights()</a>. Các adapter là các bản dump PEFT thuần túy của tên module diffusers và được nạp ở tỷ lệ đã huấn luyện (<code>alpha == rank</code>, 1.0).</p> <table><thead><tr><th>Quy trình làm việc</th><th>Đầu vào</th><th>Chia nhỏ Transformer</th><th>Adapter</th></tr></thead><tbody><tr><td><code>t2va</code></td><td><code>prompt</code></td><td><code>transformer/</code></td><td><code>fl2va/adapter.safetensors</code></td></tr><tr><td><code>fl2va</code></td><td><code>prompt</code> và <code>image</code> và/hoặc <code>last_image</code></td><td><code>transformer/</code></td><td><code>fl2va/adapter.safetensors</code></td></tr><tr><td><code>ref2va</code></td><td><code>prompt</code> và <code>references</code></td><td><code>transformer_ref/</code></td><td><code>ref2va/adapter.safetensors</code></td></tr></tbody></table> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Đã sao chép</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ModularPipeline | |
| pipe = ModularPipeline.from_pretrained(<span class="hljs-string">"Pika-Labs/Pika-H3-Flex"</span>, workflow=<span class="hljs-string">"fl2va"</span>) | |
| pipe.load_components(dtype={<span class="hljs-string">"vae"</span>: torch.float32, <span class="hljs-string">"audio_vae"</span>: torch.float32, <span class="hljs-string">"default"</span>: torch.bfloat16}) | |
| pipe.load_lora_weights(<span class="hljs-string">"Pika-Labs/Pika-H3-Flex"</span>, weight_name=<span class="hljs-string">"fl2va/adapter.safetensors"</span>)<!----></pre></div><!----> <p>Việc truyền workflow sẽ cắt bỏ các khối không liên quan đến tác vụ đó, nên chỉ phân vùng transformer của chính tác vụ được tải về, adapter sẽ định tuyến đến phân vùng duy nhất hiện có, và pipeline chỉ chấp nhận các yêu cầu của tác vụ đó — pipeline <code>fl2va</code> cần một keyframe, còn <code>t2va</code> thì không. Một pipeline giữ cả hai phân vùng (được tải mà không có <code>workflow=</code>) cần được chỉ định vị trí đặt adapter Ref2VA: <code>pipe.load_lora_weights(..., weight_name="ref2va/adapter.safetensors", load_into_transformer_ref=True)</code>. Hai VAE được phát hành ở float32 và giải mã ở float32, giống như gói đã phát hành; mọi thứ khác chạy ở bfloat16.</p> <blockquote class="tip"><p><code>pipe.doc</code> in ra những gì pipeline trước mặt bạn nhận vào và trả về — mọi đầu vào cùng giá trị mặc định, các thành phần mà nó kỳ vọng và các đầu ra mà nó tạo ra.</p></blockquote> <!--[2--><h3 class="relative group"><a id="reusing-a-loaded-minimax-h3" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#reusing-a-loaded-minimax-h3"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Tái sử dụng MiniMax-H3 đã được tải<!----></span></h3><!--]--><!----> <p>Các thành phần cơ bản là của MiniMax-H3, do đó một pipeline MiniMax-H3 đã được nạp sẵn sẽ chứa mọi thứ ngoại trừ hai bộ lập lịch và các bộ thích ứng. Phần này lắp ráp một pipeline Pika H3 Flex từ các thành phần đã nạp đó và giữ cả hai pipeline sẵn sàng song song: một <a href="/docs/diffusers/main/vi/api/modular_diffusers/pipeline_components#diffusers.ComponentsManager">ComponentsManager</a> giữ mỗi thành phần một lần và chuyển chúng xuống bộ nhớ cho cả hai, pipeline Pika H3 Flex chỉ thêm hai bộ lập lịch của nó, và các bộ thích ứng quyết định xem các transformer dùng chung sẽ chạy mô hình nào trong hai mô hình.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Đã sao chép</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ComponentsManager, ModularPipeline | |
| dtype = {<span class="hljs-string">"vae"</span>: torch.float32, <span class="hljs-string">"audio_vae"</span>: torch.float32, <span class="hljs-string">"default"</span>: torch.bfloat16} | |
| manager = ComponentsManager() | |
| manager.enable_auto_cpu_offload(device=<span class="hljs-string">"cuda"</span>) | |
| <span class="hljs-comment"># The MiniMax-H3 pipeline already in use, with every workflow loaded. `collection` registers its components in the</span> | |
| <span class="hljs-comment"># manager under that name, so they can be fetched by it later.</span> | |
| minimax = ModularPipeline.from_pretrained(<span class="hljs-string">"MiniMaxAI/MiniMax-H3"</span>, components_manager=manager, collection=<span class="hljs-string">"minimax-h3"</span>) | |
| minimax.load_components(dtype=dtype) | |
| <span class="hljs-comment"># The Pika H3 Flex pipeline, in its own collection. Only its own components are loaded: the two schedulers.</span> | |
| pika = ModularPipeline.from_pretrained(<span class="hljs-string">"Pika-Labs/Pika-H3-Flex"</span>, components_manager=manager, collection=<span class="hljs-string">"pika-h3-flex"</span>) | |
| pika.load_components(names=[<span class="hljs-string">"scheduler"</span>, <span class="hljs-string">"audio_scheduler"</span>]) | |
| <span class="hljs-comment"># The rest comes from the MiniMax-H3 collection, and `update_components` puts it in the Pika H3 Flex pipeline.</span> | |
| shared = [<span class="hljs-string">"text_encoder"</span>, <span class="hljs-string">"tokenizer"</span>, <span class="hljs-string">"processor"</span>, <span class="hljs-string">"vae"</span>, <span class="hljs-string">"audio_vae"</span>, <span class="hljs-string">"transformer"</span>, <span class="hljs-string">"transformer_ref"</span>] | |
| pika.update_components(**{name: manager.get_one(name=name, collection=<span class="hljs-string">"minimax-h3"</span>) <span class="hljs-keyword">for</span> name <span class="hljs-keyword">in</span> shared}) | |
| <span class="hljs-comment"># The adapters go into the shared transformers.</span> | |
| pika.load_lora_weights(<span class="hljs-string">"Pika-Labs/Pika-H3-Flex"</span>, weight_name=<span class="hljs-string">"fl2va/adapter.safetensors"</span>) | |
| pika.load_lora_weights( | |
| <span class="hljs-string">"Pika-Labs/Pika-H3-Flex"</span>, weight_name=<span class="hljs-string">"ref2va/adapter.safetensors"</span>, load_into_transformer_ref=<span class="hljs-literal">True</span> | |
| )<!----></pre></div><!----> <p><code>print(manager)</code> hiển thị kết quả: mỗi thành phần dùng chung được liệt kê một lần và thuộc về cả hai bộ sưu tập, bộ sưu tập Pika H3 Flex thêm hai trình lập lịch, và hai bộ chuyển đổi mang một bộ thích ứng.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Đã sao chép</div><!----></button><!----></div> <pre class="language-text "><!---->Models: | |
| Name_ID | Class | Size (GB) | Collection | |
| transformer_1397... | MiniMaxH3Transformer3DModel | 63.02 | minimax-h3 | |
| | | | pika-h3-flex | |
| transformer_ref_13... | MiniMaxH3Transformer3DModel | 63.02 | minimax-h3 | |
| | | | pika-h3-flex | |
| text_encoder_1397... | Qwen3VLForConditionalGeneration | 62.13 | minimax-h3 | |
| | | | pika-h3-flex | |
| vae_1397... | AutoencoderKLMiniMaxH3 | 9.70 | minimax-h3 | |
| | | | pika-h3-flex | |
| audio_vae_1397... | AutoencoderKLMiniMaxH3Audio | 0.56 | minimax-h3 | |
| | | | pika-h3-flex | |
| Other Components: | |
| ID | Class | Collection | |
| scheduler_1397... | MiniMaxH3Scheduler | minimax-h3 | |
| audio_scheduler_1397... | MiniMaxH3Scheduler | minimax-h3 | |
| scheduler_1397... | MiniMaxH3Scheduler | pika-h3-flex | |
| audio_scheduler_1397... | MiniMaxH3Scheduler | pika-h3-flex | |
| tokenizer_1397... | Qwen2Tokenizer | minimax-h3 | |
| | | pika-h3-flex | |
| processor_1397... | Qwen3VLProcessor | minimax-h3 | |
| | | pika-h3-flex | |
| Additional Component Info: | |
| transformer_1397...: | |
| Adapters: ['default_0'] | |
| transformer_ref_13...: | |
| Adapters: ['default_0']<!----></pre></div><!----> <p>Các adapter quyết định xem các transformers dùng chung là mô hình nào. Để quay lại MiniMax-H3, hãy gọi <code>pika.disable_lora()</code>, và đó là tất cả: yêu cầu <code>minimax(...)</code> tiếp theo sẽ chạy mô hình gốc. <code>pika.enable_lora()</code> sẽ bật lại Pika H3 Flex. Không có gì được nạp lại trong khoảng thời gian đó; trình quản lý sẽ di chuyển từng thành phần lên và xuống bộ tăng tốc khi bất kỳ pipeline nào đến lượt nó.</p> <!--[1--><h2 class="relative group"><a id="what-differs-from-minimax-h3" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#what-differs-from-minimax-h3"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Điểm khác biệt so với MiniMax-H3<!----></span></h2><!--]--><!----> <ul><li><strong>Sáu bước, không có <code>num_inference_steps</code>.</strong> Cả hai instance <a href="/docs/diffusers/main/vi/api/schedulers/minimax_h3#diffusers.MiniMaxH3Scheduler">MiniMaxH3Scheduler</a> (<code>shift=12.0</code> cho video, <code>shift=3.0</code> cho audio) đều chạy với <code>stochastic_sampling</code> trên cấu hình <code>denoising_step_list</code> của pipeline, theo lịch đã phát hành <code>[1000, 750, 500, 250, 100, 40, 0]</code>: mỗi bước dự đoán mẫu sạch, và tất cả các bước trừ bước cuối cùng sẽ thêm nhiễu mới vào mẫu đó để đưa về sigma tiếp theo. Số lượng bước là cam kết của adapter và không phải là một đầu vào.</li> <li><strong>Nhầm mới ở mỗi bước.</strong> Một yêu cầu lấy mẫu từ <code>generator</code> của nó theo một thứ tự cố định: một lần lấy mẫu cho mỗi keyframe hoặc tham chiếu hình ảnh cho nhiễu điều kiện, nhiễu video, nhiễu âm thanh, và sau đó là các lần lấy mẫu tái nhiễu video và âm thanh của mỗi bước trong năm bước đầu tiên. Truyền <code>latents</code> hoặc <code>audio_latents</code> sẽ thay thế hai lần lấy mẫu ban đầu và giữ nguyên các lần còn lại.</li> <li><strong>Keyframe được cắt, không bị kéo giãn.</strong> Một keyframe <code>fl2va</code> sẽ được cắt theo tâm để khớp với tỷ lệ khung hình của canvas ở độ phân giải của chính nó, sau đó được thay đổi kích thước để vừa với canvas.</li> <li><strong>Tham chiếu tuân theo cấp độ độ phân giải của canvas.</strong> Pika H3 Flex tạo ra trên một bảng bucket — một cấp 480p và một cấp 768p, mỗi cấp có mười một tỷ lệ khung hình — và một yêu cầu <code>ref2va</code> được điều kiện hóa theo cấp của canvas của nó: một hình ảnh tham chiếu được mã hóa ở cạnh ngắn 1024 pixel dưới cấp 768 và 2048 từ cấp đó trở lên, và một video tham chiếu được đặt theo quy tắc canvas của chính cấp đó. Mọi video hoặc âm thanh độc lập tham chiếu đều có độ dài từ 2 đến 15 giây, và tổng độ dài của các video và tổng độ dài của các âm thanh độc lập mỗi loại đều không vượt quá 15 giây.</li></ul> <!--[1--><h2 class="relative group"><a id="generation" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#generation"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Sinh<!----></span></h2><!--]--><!----> <p>Các bucket đã phát hành là những canvas mà Pika H3 Flex được xác thực trên đó. Truyền một bucket làm <code>height</code> và <code>width</code>:</p> <table><thead><tr><th></th><th>21:9</th><th>16:9</th><th>3:2</th><th>4:3</th><th>5:4</th><th>1:1</th><th>4:5</th><th>3:4</th><th>2:3</th><th>9:16</th><th>9:21</th></tr></thead><tbody><tr><td>480p</td><td>960x416</td><td>832x480</td><td>704x480</td><td>640x480</td><td>608x480</td><td>480x480</td><td>480x608</td><td>480x640</td><td>480x704</td><td>480x832</td><td>416x960</td></tr><tr><td>768p</td><td>1536x672</td><td>1344x768</td><td>1152x768</td><td>1024x768</td><td>960x768</td><td>768x768</td><td>768x960</td><td>768x1024</td><td>768x1152</td><td>768x1344</td><td>672x1536</td></tr></tbody></table> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Đã sao chép</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ComponentsManager, ModularPipeline | |
| <span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image | |
| <span class="hljs-keyword">from</span> diffusers.utils.export_utils <span class="hljs-keyword">import</span> encode_video | |
| <span class="hljs-comment"># 61.7GB of transformer and 62.1GB of conditioner do not sit on one accelerator, so the components are</span> | |
| <span class="hljs-comment"># registered in a manager that moves each one on and off as the blocks reach it.</span> | |
| manager = ComponentsManager() | |
| manager.enable_auto_cpu_offload(device=<span class="hljs-string">"cuda"</span>) <span class="hljs-comment"># or "mps", "xpu", "cpu"</span> | |
| <span class="hljs-comment"># Create one pipeline for all supported workflows, then load the `fl2va` workflow's components, which is</span> | |
| <span class="hljs-comment"># enough to run both the fl2va and t2va requests below.</span> | |
| pipe = ModularPipeline.from_pretrained(<span class="hljs-string">"Pika-Labs/Pika-H3-Flex"</span>, components_manager=manager) | |
| pipe.load_components( | |
| workflow=<span class="hljs-string">"fl2va"</span>, dtype={<span class="hljs-string">"vae"</span>: torch.float32, <span class="hljs-string">"audio_vae"</span>: torch.float32, <span class="hljs-string">"default"</span>: torch.bfloat16} | |
| ) | |
| pipe.load_lora_weights(<span class="hljs-string">"Pika-Labs/Pika-H3-Flex"</span>, weight_name=<span class="hljs-string">"fl2va/adapter.safetensors"</span>) | |
| prompt = ( | |
| <span class="hljs-string">"integrated_multimodal_description: A cinematic close shot of a red ceramic cup on a wooden table beside an "</span> | |
| <span class="hljs-string">"open window. A soft breeze moves a linen curtain. The camera slowly pushes toward the cup as warm morning "</span> | |
| <span class="hljs-string">"light crosses the table.\n"</span> | |
| <span class="hljs-string">"overall_soundscape: Gentle wind through the window and faint birdsong outside. No speech.\n"</span> | |
| <span class="hljs-string">"non_diegetic_music: None.\n"</span> | |
| ) | |
| outputs = [<span class="hljs-string">"videos"</span>, <span class="hljs-string">"audio"</span>, <span class="hljs-string">"sampling_rate"</span>] | |
| <span class="hljs-comment"># Text to video + audio on the 480p 16:9 bucket, 5 seconds.</span> | |
| results = pipe( | |
| prompt=prompt, | |
| height=<span class="hljs-number">480</span>, | |
| width=<span class="hljs-number">832</span>, | |
| num_frames=<span class="hljs-number">124</span>, | |
| generator=torch.Generator(<span class="hljs-string">"cuda"</span>).manual_seed(<span class="hljs-number">42</span>), | |
| output=outputs | |
| ) | |
| <span class="hljs-comment"># First frame (and optionally `last_image`) to video + audio. The keyframe is center-cropped onto the canvas and</span> | |
| <span class="hljs-comment"># held as the first frame, so the prompt describes the keyframe and what happens from it.</span> | |
| image = load_image( | |
| <span class="hljs-string">"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/astronaut.jpg"</span> | |
| ) | |
| i2va_prompt = ( | |
| <span class="hljs-string">"For the target video, at 0.00 seconds into the target video, <Picture 1> (from [Shot 1]) is fully referenced.\n\n"</span> | |
| <span class="hljs-string">"integrated_multimodal_description: [Shot 1] Begin with the supplied image of a small toy astronaut figurine "</span> | |
| <span class="hljs-string">"standing on a grey rocky moon surface, holding a white egg-shaped object. Preserve the figurine, its orange "</span> | |
| <span class="hljs-string">"visor and the rocks. The astronaut slowly turns its helmet toward the camera and lifts the egg a little; fine "</span> | |
| <span class="hljs-string">"dust drifts up around its boots. The camera slowly pushes in in one continuous shot. By the end the astronaut "</span> | |
| <span class="hljs-string">"stands still, egg held up.\n\n"</span> | |
| <span class="hljs-string">"overall_soundscape: Soft low wind and faint crunch of dust under the boots. No speech.\n\n"</span> | |
| <span class="hljs-string">"non_diegetic_music: N/A\n"</span> | |
| ) | |
| results = pipe( | |
| prompt=i2va_prompt, | |
| image=image, | |
| height=<span class="hljs-number">480</span>, | |
| width=<span class="hljs-number">832</span>, | |
| num_frames=<span class="hljs-number">124</span>, | |
| generator=torch.Generator(<span class="hljs-string">"cuda"</span>).manual_seed(<span class="hljs-number">42</span>), | |
| output=outputs, | |
| ) | |
| encode_video( | |
| results[<span class="hljs-string">"videos"</span>][<span class="hljs-number">0</span>], | |
| fps=<span class="hljs-number">24</span>, | |
| output_path=<span class="hljs-string">"pika_h3_flex_fl2va.mp4"</span>, | |
| audio=results[<span class="hljs-string">"audio"</span>][<span class="hljs-number">0</span>], | |
| audio_sample_rate=results[<span class="hljs-string">"sampling_rate"</span>], | |
| )<!----></pre></div><!----> <p>Workflow <code>ref2va</code> nhận một danh sách các tham chiếu có thứ tự — tối đa 9 hình ảnh, 3 video và 3 đoạn âm thanh, tổng cộng 12 — theo cách mà MiniMax-H3 thực hiện, với một lớp tham chiếu cho mỗi loại dữ liệu. Đây cũng là yêu cầu cần nhiều bộ nhớ nhất: các tham chiếu thêm hàng của chúng vào chuỗi, và ở độ phân giải 768p, riêng transformer đã lấp đầy một card 80 GB. Do đó, ví dụ bên dưới sẽ stream các khối của transformer từ bộ nhớ CPU một lần một, trong khi manager di chuyển các thành phần khác vào và ra khỏi thiết bị như trước. Nó chạy một yêu cầu tham chiếu 768p trên một card 80 GB; nếu không dùng streaming, hãy giữ ở 480p.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Đã sao chép</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ComponentsManager, ModularPipeline | |
| <span class="hljs-keyword">from</span> diffusers.modular_pipelines.pika_h3_flex <span class="hljs-keyword">import</span> ( | |
| PikaH3FlexAudioReference, | |
| PikaH3FlexImageReference, | |
| PikaH3FlexVideoReference, | |
| ) | |
| manager = ComponentsManager() | |
| manager.enable_auto_cpu_offload(device=<span class="hljs-string">"cuda"</span>) <span class="hljs-comment"># or "mps", "xpu", "cpu"</span> | |
| pipe = ModularPipeline.from_pretrained( | |
| <span class="hljs-string">"Pika-Labs/Pika-H3-Flex"</span>, workflow=<span class="hljs-string">"ref2va"</span>, components_manager=manager | |
| ) | |
| pipe.load_components(dtype={<span class="hljs-string">"vae"</span>: torch.float32, <span class="hljs-string">"audio_vae"</span>: torch.float32, <span class="hljs-string">"default"</span>: torch.bfloat16}) | |
| pipe.load_lora_weights(<span class="hljs-string">"Pika-Labs/Pika-H3-Flex"</span>, weight_name=<span class="hljs-string">"ref2va/adapter.safetensors"</span>) | |
| <span class="hljs-comment"># Keep the transformer in CPU memory and bring in one block at a time while it runs.</span> | |
| pipe.transformer_ref.enable_group_offload( | |
| onload_device=torch.device(<span class="hljs-string">"cuda"</span>), | |
| offload_device=torch.device(<span class="hljs-string">"cpu"</span>), | |
| offload_type=<span class="hljs-string">"block_level"</span>, | |
| num_blocks_per_group=<span class="hljs-number">1</span>, | |
| use_stream=<span class="hljs-literal">True</span>, | |
| ) | |
| results = pipe( | |
| prompt=<span class="hljs-string">"subject_definitions: <Subject 1> is the woman in <Picture 1>. summary: [reference generation] <Subject 1> waves at the camera."</span>, | |
| references=[ | |
| PikaH3FlexImageReference.from_file(<span class="hljs-string">"subject.png"</span>), | |
| PikaH3FlexVideoReference.from_file(<span class="hljs-string">"motion_ref.mp4"</span>), <span class="hljs-comment"># frames, their `fps` and the soundtrack</span> | |
| PikaH3FlexAudioReference.from_file(<span class="hljs-string">"voice.wav"</span>), <span class="hljs-comment"># waveform and its `sample_rate`</span> | |
| ], | |
| height=<span class="hljs-number">768</span>, | |
| width=<span class="hljs-number">1344</span>, | |
| num_frames=<span class="hljs-number">124</span>, | |
| generator=torch.Generator(<span class="hljs-string">"cuda"</span>).manual_seed(<span class="hljs-number">42</span>), | |
| output=[<span class="hljs-string">"videos"</span>, <span class="hljs-string">"audio"</span>, <span class="hljs-string">"sampling_rate"</span>], | |
| )<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="diffusers.PikaH3FlexModularPipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.PikaH3FlexModularPipeline"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->PikaH3FlexModularPipeline<!----></span></h2><!--]--><!----> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.PikaH3FlexModularPipeline"><!----><h3 class="!m-0"><span class="flex-1 break-all md:text-lg bg-gradient-to-r px-2.5 py-1.5 rounded-xl from-indigo-50/70 to-white dark:from-gray-900 dark:to-gray-950 dark:text-indigo-300 text-indigo-700"><svg class="mr-1.5 text-indigo-500 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width=".8em" height=".8em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg><span class="font-light">lớp</span> <span class="font-medium">diffusers.</span><span class="font-semibold">PikaH3FlexModularPipeline</span></span></h3><!----> <a id="diffusers.PikaH3FlexModularPipeline" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.PikaH3FlexModularPipeline"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/pika_h3_flex/modular_pipeline.py#L211" target="_blank"><span><</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">blocks<span class="opacity-60">: diffusers.modular_pipelines.modular_pipeline.ModularPipelineBlocks | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">pretrained_model_name_or_path<span class="opacity-60">: str | os.PathLike | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">components_manager<span class="opacity-60">: diffusers.modular_pipelines.components_manager.ComponentsManager | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">collection<span class="opacity-60">: str | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">workflow<span class="opacity-60">: str | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">modular_config_dict<span class="opacity-60">: dict[str, typing.Any] | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">config_dict<span class="opacity-60">: dict[str, typing.Any] | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">**kwargs<span class="opacity-60"></span></span></span><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>Một ModularPipeline để tạo video + âm thanh kết hợp với Pika H3 Flex, mô hình MiniMax-H3 sáu bước sau huấn luyện: các luồng công việc <code>t2va</code> (chỉ văn bản) và <code>fl2va</code> (khung hình chính đầu và/hoặc cuối) đối với checkpoint phân vùng <code>transformer/</code> với adapter <code>fl2va</code>, và luồng công việc <code>ref2va</code> (tham chiếu toàn diện) đối với <code>transformer_ref/</code> với adapter <code>ref2va</code>.</p> <p>Các thành phần cơ bản là của MiniMax-H3, và bản phát hành Pika H3 Flex là một cặp adapter LoRA rank-128 nằm trên hai phân vùng transformer, do đó một pipeline được lắp ráp theo hai bước: các thành phần được tải thông qua <code>modular_model_index.json</code> có tên các thành phần cơ bản và hai scheduler, và adapter của workflow được chọn được tải bằng <a href="/docs/diffusers/main/vi/api/loaders/lora#diffusers.loaders.MiniMaxH3LoraLoaderMixin.load_lora_weights">load_lora_weights()</a>.</p> <div class="relative group rounded-md"><a id="diffusers.PikaH3FlexModularPipeline.example" class="header-link block pr-0.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.PikaH3FlexModularPipeline.example"><span><svg class="text-smd" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Đã sao chép</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ModularPipeline | |
| pipe = ModularPipeline.from_pretrained(<span class="hljs-string">"Pika-Labs/Pika-H3-Flex"</span>, workflow=<span class="hljs-string">"fl2va"</span>) | |
| pipe.load_components(dtype={<span class="hljs-string">"vae"</span>: torch.float32, <span class="hljs-string">"audio_vae"</span>: torch.float32, <span class="hljs-string">"default"</span>: torch.bfloat16}) | |
| pipe.load_lora_weights(<span class="hljs-string">"Pika-Labs/Pika-H3-Flex"</span>, weight_name=<span class="hljs-string">"fl2va/adapter.safetensors"</span>)<!----></pre></div><!----></div><!----> <p>Giống như MiniMax-H3, Pika H3 Flex khử nhiễu <strong>một chuỗi đã đóng gói</strong> chứa đồng thời điều kiện văn bản, các latent điều kiện từ khung hình chính hoặc tham chiếu, các latent âm thanh và các latent video. Đó là lý do tại sao các khối truyền một bố cục hàng (row layout) thay vì các tensor theo từng phương thức (modality), và lý do tại sao pipeline mang theo hai trình lập lịch (scheduler) (<code>shift = 12.0</code> cho video, <code>shift = 3.0</code> cho âm thanh) được thực hiện trong một lần gọi transformer duy nhất. Khác với MiniMax-H3, hai trình lập lịch này là các instance của <a href="/docs/diffusers/main/vi/api/schedulers/minimax_h3#diffusers.MiniMaxH3Scheduler">MiniMaxH3Scheduler</a> với <code>stochastic_sampling</code> trên danh sách sáu bước khử nhiễu cố định <code>denoising_step_list</code>: không có <code>num_inference_steps</code>, và mỗi bước sẽ lấy một nhiễu mới từ generator của yêu cầu.</p> <p>Các adapter được chưng cất theo hướng dẫn giống như mô hình gốc của chúng: không có guider, không có <code>negative_prompt</code> và không có <code>guidance_scale</code>, và mỗi bước chỉ chạy đúng một lần truyền thẳng.</p> <p>Module này chứa các thông tin mô hình mà mọi khối đều dựa vào — hình học suy ra từ cấu hình dưới dạng các thuộc tính, canvas, phép tính phân cấp và số khung dưới dạng các hàm — trong khi các hợp đồng điều kiện, mã hóa và nhiễu được đặt trực tiếp trên chính các khối.</p></div> <!--[1--><h2 class="relative group"><a id="diffusers.PikaH3FlexBlocks" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.PikaH3FlexBlocks"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->PikaH3FlexBlocks<!----></span></h2><!--]--><!----> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.PikaH3FlexBlocks"><!----><h3 class="!m-0"><span class="flex-1 break-all md:text-lg bg-gradient-to-r px-2.5 py-1.5 rounded-xl from-indigo-50/70 to-white dark:from-gray-900 dark:to-gray-950 dark:text-indigo-300 text-indigo-700"><svg class="mr-1.5 text-indigo-500 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width=".8em" height=".8em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg><span class="font-light">lớp</span> <span class="font-medium">diffusers.</span><span class="font-semibold">PikaH3FlexBlocks</span></span></h3><!----> <a id="diffusers.PikaH3FlexBlocks" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.PikaH3FlexBlocks"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/pika_h3_flex/modular_blocks_pika_h3_flex.py#L668" target="_blank"><span><</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>Các khối pipeline Auto Modular cho việc tạo video + âm thanh đồng thời với Pika H3 Flex: các workflow <code>t2va</code> (chỉ văn bản), <code>fl2va</code> (khung hình chính đầu và/hoặc cuối) và <code>ref2va</code> (tham chiếu toàn diện), được chọn dựa trên các đầu vào <code>references</code> và khung hình chính. Các workflow <code>t2va</code> và <code>fl2va</code> chạy phân vùng <code>transformer</code> với adapter <code>fl2va</code>, còn <code>ref2va</code> chạy phân vùng <code>transformer_ref</code> với adapter <code>ref2va</code>, do đó hãy nạp adapter của workflow mà yêu cầu sử dụng. | |
| Nếu không có <code>workflow=</code>, việc nạp các thành phần sẽ kéo <strong>cả hai</strong> phân vùng transformer 61.7GB — hãy truyền một trong số chúng để chỉ nạp những gì nhiệm vụ cần.</p> <p>Các quy trình làm việc được hỗ trợ:</p> <ul><li><code>t2va</code>: yêu cầu <code>prompt</code></li> <li><code>fl2va</code>: yêu cầu <code>prompt</code>, <code>image</code> hoặc <code>prompt</code>, <code>last_image</code></li> <li><code>ref2va</code>: yêu cầu <code>prompt</code>, <code>references</code></li></ul> <p>Các thành phần: | |
| image_processor (<code>VaeImageProcessor</code>) text_encoder (<code>Qwen3VLForConditionalGeneration</code>) tokenizer | |
| (<code>Qwen2Tokenizer</code>) processor (<code>Qwen3VLProcessor</code>) vae (<code>AutoencoderKLMiniMaxH3</code>) audio_vae | |
| (<code>AutoencoderKLMiniMaxH3Audio</code>) scheduler (<code>MiniMaxH3Scheduler</code>) audio_scheduler (<code>MiniMaxH3Scheduler</code>) | |
| transformer_ref (<code>MiniMaxH3Transformer3DModel</code>) transformer (<code>MiniMaxH3Transformer3DModel</code>) video_processor | |
| (<code>VideoProcessor</code>)</p> <p>Configs: | |
| canvas_short_edge (mặc định: 768) canvas_max_pixels (mặc định: 1032192) denoising_step_list (mặc định: [1000, | |
| 750, 500, 250, 100, 40, 0])</p> <p>Inputs: | |
| references (<code>list</code>, <em>tùy chọn</em>): | |
| Các tham chiếu để điều kiện hóa, <strong>theo thứ tự mà mô hình nên đọc chúng</strong>: thứ tự này gắn nhãn cho chúng trong cách trình bày prompt và bố trí chúng trên đồng hồ rotary chung, do đó một thứ tự khác sẽ là một yêu cầu khác. Mỗi dataclass cho một chế độ (modality), tất cả đều giữ phương tiện trong bộ nhớ — một <code>PikaH3FlexImageReference</code> (tối đa 9), một <code>PikaH3FlexVideoReference</code> với <code>fps</code> riêng của nó (tối đa 3, trong đó bản nhạc nền <code>audio</code> cũng được điều kiện hóa), hoặc một <code>PikaH3FlexAudioReference</code> với <code>sample_rate</code> riêng của nó (tối đa 3) — tổng cộng tối đa 12 tham chiếu, và các tham chiếu audio không thể là duy nhất. Mỗi tham chiếu video hoặc audio độc lập có độ dài từ 2 đến 15 giây, và tổng độ dài của các video và tổng độ dài của các audio độc lập mỗi loại đều tối đa 15 giây. Các khối này không bao giờ mở tệp phương tiện: hãy giải mã bằng classmethod <code>from_file</code> của từng lớp, điều này sẽ mang theo các tần số. | |
| height (<code>int</code>, <em>tùy chọn</em>): | |
| Chiều cao của video được tạo ra tính bằng pixel, phải là bội số của 32. | |
| width (<code>int</code>, <em>tùy chọn</em>): | |
| Chiều rộng của video được tạo ra tính bằng pixel, phải là bội số của 32. | |
| num_frames (<code>int</code>, <em>tùy chọn</em>): | |
| Số khung hình cần tạo ra, ở tốc độ cố định 24 fps: từ 120 đến 360, tức là từ 5 đến 15 giây, được làm tròn lên đến <code>17 * n + 5</code> gần nhất mà VAE của video có thể giải mã. Để tạo một video có độ dài bằng với bản nhạc nền tham chiếu, hãy truyền <code>round(samples / sample_rate * 24)</code>. | |
| image (<code>Image</code>, <em>tùy chọn</em>): | |
| Khung hình chính (keyframe) mà video bắt đầu từ đó. Nó sẽ được cắt theo tâm để khớp với tỷ lệ khung hình của canvas và được thay đổi kích thước lên canvas; canvas mặc định được suy ra từ tỷ lệ khung hình của chính nó. | |
| last_image (<code>Image</code>, <em>tùy chọn</em>): | |
| Khung hình chính mà video kết thúc ở đó. Có thể truyền riêng để tạo <em>đến</em> một khung hình. Nó được cắt theo tâm để khớp với tỷ lệ khung hình của canvas và được thay đổi kích thước lên canvas, giống như <code>image</code>. | |
| prompt (<code>str</code>): | |
| Prompt để hướng dẫn quá trình tạo ra, là một chuỗi duy nhất. | |
| normalized_references (<code>list</code>, <em>tùy chọn</em>): | |
| Các tham chiếu đã được chuẩn hóa bởi bước thiết lập, theo thứ tự đóng gói. | |
| keyframes (<code>list</code>, <em>tùy chọn</em>): | |
| Các khung hình chính được đặt lên canvas đích, theo thứ tự đóng gói. | |
| condition_latents (<code>list</code>, <em>tùy chọn</em>): | |
| Các latent điều kiện hóa video đã được mã hóa, một latent cho mỗi tham chiếu hình ảnh và video theo thứ tự đóng gói. Hình dạng của chúng là nơi mà hình học của mỗi khối tham chiếu bắt nguồn. | |
| audio_condition_latents (<code>list</code>, <em>tùy chọn</em>): | |
| Các hàng latent điều kiện hóa audio đã được mã hóa, một hàng cho mỗi tham chiếu chứa audio theo thứ tự đóng gói. | |
| generator (<code>Generator</code>, <em>tùy chọn</em>): | |
| Trình tạo (generator) của yêu cầu. Nhiễu điều kiện hóa được lấy từ nó trước tiên, một lần lấy cho mỗi điều kiện, trước khi lấy nhiễu của các hàng được tạo ra. | |
| latents (<code>Tensor</code>): | |
| Nhiễu video được tạo trước có hình dạng <code>(1, 24, num_latent_frames, latent_height, latent_width)</code>, được sử dụng thay cho việc lấy ngẫu nhiên. | |
| audio_latents (<code>Tensor</code>): | |
| Nhiễu audio được tạo trước có hình dạng <code>(2, 32, num_audio_latents)</code>. | |
| *<em>denoiser_input_fields (<code>None</code>,</em>tùy chọn<em>): | |
| Mô tả cấu trúc của chuỗi đóng gói mà transformer đọc theo tên: <code>token_tags</code>, <code>position_ids</code> và ba tensor chỉ số hàng. | |
| attention_kwargs (<code>dict</code>,</em>tùy chọn<em>): | |
| Các kwargs bổ sung cho các bộ xử lý attention. | |
| keyframe_anchors (<code>tuple</code>,</em>tùy chọn<em>, mặc định là ()): | |
| Đầu nào của video mà mỗi khung hình chính được neo vào, theo thứ tự đóng gói. | |
| output_type (<code>str</code>,</em>tùy chọn*, mặc định là pil): | |
| Định dạng đầu ra: ‘pil’, ‘np’ hoặc ‘pt’.</p> <p>Outputs: | |
| videos (<code>list</code>): | |
| Video được tạo ra. | |
| audio (<code>Tensor</code>): | |
| Âm thanh được tạo ra, có hình dạng <code>(1, 2, num_samples)</code>. | |
| sampling_rate (<code>int</code>): | |
| Tần số lấy mẫu của âm thanh được tạo ra, tính bằng Hz.</p></div> <!--[1--><h2 class="relative group"><a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->PikaH3FlexImageReference<!----></span></h2><!--]--><!----> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference"><!----><h3 class="!m-0"><span class="flex-1 break-all md:text-lg bg-gradient-to-r px-2.5 py-1.5 rounded-xl from-indigo-50/70 to-white dark:from-gray-900 dark:to-gray-950 dark:text-indigo-300 text-indigo-700"><svg class="mr-1.5 text-indigo-500 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width=".8em" height=".8em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg><span class="font-light">class</span> <span class="font-medium">diffusers.modular_pipelines.pika_h3_flex.</span><span class="font-semibold">PikaH3FlexImageReference</span></span></h3><!----> <a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/pika_h3_flex/references.py#L83" target="_blank"><span><</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><span class="comma cursor-pointer"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">image<span class="opacity-60">: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor]</span></span></span><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[0--><p class="flex items-center font-semibold !mt-2 !mb-2 text-gray-800">Tham số <span class="flex-auto border-t-2 border-gray-100 dark:border-gray-700 ml-3"></span></p> <ul class="px-2"><!--[--><li class="text-base !pl-4 my-3 rounded "><span class="group flex space-x-1.5 items-start"><a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference.image" class="header-link block pr-0.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference.image"><span><svg class="text-smd" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!----><strong>image</strong> (<code>PIL.Image.Image</code>, <code>np.ndarray</code> hoặc <code>torch.Tensor</code>) — | |
| Hình ảnh tham chiếu: một hình ảnh, một mảng <code>(height, width, 3)</code> hoặc một tensor <code>(3, height, width)</code>, <code>uint8</code> hoặc | |
| số dấu phẩy động trong khoảng <code>[0, 1]</code>. Nó không bao giờ ràng buộc hình học được tạo ra — nó được mã hóa ở cạnh ngắn của chính nó, 2048 đối với checkpoint đã phát hành, bất kể canvas mà yêu cầu tạo ra là gì.<!----></span></span></li><!--]--></ul><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>Tham chiếu chủ thể, phong cách hoặc cảnh: tối đa 9 tham chiếu mỗi yêu cầu.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference.from_file"><!----><h4 class="!m-0"><span class="flex-1 rounded-xl py-0.5 break-all bg-gradient-to-r from-blue-50/60 to-white dark:from-gray-900 dark:to-gray-950 text-blue-700 dark:text-blue-300 font-medium px-2"><svg width="1em" height="1em" viewBox="0 0 32 33" class="mr-1 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg"><path d="M5.80566 18.3545C4.90766 17.4565 4.90766 16.0005 5.80566 15.1025L14.3768 6.53142C15.2748 5.63342 16.7307 5.63342 17.6287 6.53142L26.1999 15.1025C27.0979 16.0005 27.0979 17.4565 26.1999 18.3545L17.6287 26.9256C16.7307 27.8236 15.2748 27.8236 14.3768 26.9256L5.80566 18.3545Z" fill="currentColor" fill-opacity="0.25"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16.4801 13.9619C16.4801 12.9761 16.7467 12.5436 16.9443 12.3296C17.1764 12.078 17.5731 11.8517 18.2275 11.707C18.8821 11.5623 19.638 11.5342 20.4038 11.5582C20.7804 11.57 21.1341 11.5932 21.4719 11.6156L21.5263 11.6193C21.8195 11.6389 22.1626 11.6618 22.4429 11.6618V7.40825C22.3209 7.40825 22.1219 7.39596 21.7544 7.37149C21.4202 7.34925 20.9976 7.32115 20.5371 7.30672C19.6286 7.27824 18.4672 7.29779 17.3093 7.55377C16.1512 7.8098 14.8404 8.33724 13.8181 9.4452C12.7612 10.5907 12.2266 12.1236 12.2266 13.9619V15.0127H10.6836V19.2662H12.2266V26.6332H16.4801V19.2662H20.3394V15.0127H16.4801V13.9619Z" fill="currentColor"/></svg>from_file</span></h4><!----> <a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference.from_file" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference.from_file"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/pika_h3_flex/references.py#L99" target="_blank"><span><</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><span class="comma cursor-pointer"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">media<span class="opacity-60"></span></span></span><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[0--><p class="flex items-center font-semibold !mt-2 !mb-2 text-gray-800">Tham số <span class="flex-auto border-t-2 border-gray-100 dark:border-gray-700 ml-3"></span></p> <ul class="px-2"><!--[--><li class="text-base !pl-4 my-3 rounded "><span class="group flex space-x-1.5 items-start"><a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference.from_file.media" class="header-link block pr-0.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexImageReference.from_file.media"><span><svg class="text-smd" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!----><strong>media</strong> (<code>str</code> hoặc <code>os.PathLike</code>) — Đường dẫn hoặc URL của hình ảnh.<!----></span></span></li><!--]--></ul><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>Tải tệp ảnh vào <code>PikaH3FlexImageReference</code>, thông qua <a href="/docs/diffusers/main/vi/api/utilities#diffusers.utils.load_image">load_image()</a>.</p></div></div> <!--[1--><h2 class="relative group"><a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->PikaH3FlexVideoReference<!----></span></h2><!--]--><!----> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference"><!----><h3 class="!m-0"><span class="flex-1 break-all md:text-lg bg-gradient-to-r px-2.5 py-1.5 rounded-xl from-indigo-50/70 to-white dark:from-gray-900 dark:to-gray-950 dark:text-indigo-300 text-indigo-700"><svg class="mr-1.5 text-indigo-500 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width=".8em" height=".8em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg><span class="font-light">class</span> <span class="font-medium">diffusers.modular_pipelines.pika_h3_flex.</span><span class="font-semibold">PikaH3FlexVideoReference</span></span></h3><!----> <a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/pika_h3_flex/references.py#L111" target="_blank"><span><</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><span class="comma cursor-pointer"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">frames<span class="opacity-60">: typing.Union[list[PIL.Image.Image], numpy.ndarray, torch.Tensor]</span></span></span><span class="comma cursor-pointer"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">fps<span class="opacity-60">: float | None = None</span></span></span><span class="comma cursor-pointer"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">audio<span class="opacity-60">: typing.Optional[torch.Tensor] = None</span></span></span><span class="comma cursor-pointer"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">sample_rate<span class="opacity-60">: int | None = None</span></span></span><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[0--><p class="flex items-center font-semibold !mt-2 !mb-2 text-gray-800">Tham số <span class="flex-auto border-t-2 border-gray-100 dark:border-gray-700 ml-3"></span></p> <ul class="px-2"><!--[--><li class="text-base !pl-4 my-3 rounded "><span class="group flex space-x-1.5 items-start"><a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.frames" class="header-link block pr-0.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.frames"><span><svg class="text-smd" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!----><strong>frames</strong> (<code>list[PIL.Image.Image]</code>, <code>np.ndarray</code> hoặc <code>torch.Tensor</code>) — | |
| Các khung tham chiếu: một danh sách các hình ảnh, một mảng <code>(num_frames, height, width, 3)</code> hoặc một tensor <code>(num_frames, 3, height, width)</code>, <code>uint8</code> hoặc số dấu phẩy động trong khoảng <code>[0, 1]</code>.<!----></span></span></li><li class="text-base !pl-4 my-3 rounded "><span class="group flex space-x-1.5 items-start"><a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.fps" class="header-link block pr-0.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.fps"><span><svg class="text-smd" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!----><strong>fps</strong> (<code>float</code>, <em>tùy chọn</em>, mặc định là 24.0) — | |
| Tốc độ khung hình mà <code>frames</code> mang theo, đây là yếu tố quyết định việc đặt các khối thị giác của tham chiếu lên lưới 2 fps của bộ điều kiện. Đồng hồ riêng của MiniMax-H3 là 24 fps, do đó bất kỳ tốc độ nào khác đều được lấy mẫu lại lên 24 fps bằng cách loại bỏ và nhân bản toàn bộ các khung hình — điều này khiến trường này trở thành nơi cần thiết lập chính xác khi các khung hình được lấy từ một tệp.<!----></span></span></li><li class="text-base !pl-4 my-3 rounded "><span class="group flex space-x-1.5 items-start"><a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.audio" class="header-link block pr-0.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.audio"><span><svg class="text-smd" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!----><strong>audio</strong> (<code>torch.Tensor</code> có hình dạng <code>(channels, num_samples)</code>, <em>tùy chọn</em>) — | |
| Bản nhạc nền của video này, đơn âm hoặc stereo, được điều kiện như bản thân của tham chiếu chứ không phải như một tham chiếu riêng. Nếu bỏ qua, tham chiếu sẽ chỉ điều kiện dựa trên chuyển động.<!----></span></span></li><li class="text-base !pl-4 my-3 rounded "><span class="group flex space-x-1.5 items-start"><a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.sample_rate" class="header-link block pr-0.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.sample_rate"><span><svg class="text-smd" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!----><strong>sample_rate</strong> (<code>int</code>, <em>tùy chọn</em>) — | |
| Tốc độ mà <code>audio</code> mang các mẫu của nó. Nếu bỏ trống, giá trị này sẽ là tốc độ riêng của VAE audio, khiến các mẫu không bị thay đổi; bất kỳ tốc độ nào khác sẽ được lấy mẫu lại lên tốc độ đó.<!----></span></span></li><!--]--></ul><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>Tham chiếu chuyển động và máy quay: tối đa 3 mỗi yêu cầu, được điều kiện cùng với bản nhạc nền riêng của nó.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.from_file"><!----><h4 class="!m-0"><span class="flex-1 rounded-xl py-0.5 break-all bg-gradient-to-r from-blue-50/60 to-white dark:from-gray-900 dark:to-gray-950 text-blue-700 dark:text-blue-300 font-medium px-2"><svg width="1em" height="1em" viewBox="0 0 32 33" class="mr-1 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg"><path d="M5.80566 18.3545C4.90766 17.4565 4.90766 16.0005 5.80566 15.1025L14.3768 6.53142C15.2748 5.63342 16.7307 5.63342 17.6287 6.53142L26.1999 15.1025C27.0979 16.0005 27.0979 17.4565 26.1999 18.3545L17.6287 26.9256C16.7307 27.8236 15.2748 27.8236 14.3768 26.9256L5.80566 18.3545Z" fill="currentColor" fill-opacity="0.25"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16.4801 13.9619C16.4801 12.9761 16.7467 12.5436 16.9443 12.3296C17.1764 12.078 17.5731 11.8517 18.2275 11.707C18.8821 11.5623 19.638 11.5342 20.4038 11.5582C20.7804 11.57 21.1341 11.5932 21.4719 11.6156L21.5263 11.6193C21.8195 11.6389 22.1626 11.6618 22.4429 11.6618V7.40825C22.3209 7.40825 22.1219 7.39596 21.7544 7.37149C21.4202 7.34925 20.9976 7.32115 20.5371 7.30672C19.6286 7.27824 18.4672 7.29779 17.3093 7.55377C16.1512 7.8098 14.8404 8.33724 13.8181 9.4452C12.7612 10.5907 12.2266 12.1236 12.2266 13.9619V15.0127H10.6836V19.2662H12.2266V26.6332H16.4801V19.2662H20.3394V15.0127H16.4801V13.9619Z" fill="currentColor"/></svg>from_file</span></h4><!----> <a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.from_file" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.from_file"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/pika_h3_flex/references.py#L147" target="_blank"><span><</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><span class="comma cursor-pointer"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">media<span class="opacity-60"></span></span></span><!--]--> <span>)</span> <!--[0--><span class="font-bold">→</span> <span class="rounded hover:bg-gray-400 cursor-pointer"><!----><span><code>PikaH3FlexVideoReference</code></span><!----></span><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[0--><p class="flex items-center font-semibold !mt-2 !mb-2 text-gray-800">Tham số <span class="flex-auto border-t-2 border-gray-100 dark:border-gray-700 ml-3"></span></p> <ul class="px-2"><!--[--><li class="text-base !pl-4 my-3 rounded "><span class="group flex space-x-1.5 items-start"><a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.from_file.media" class="header-link block pr-0.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.from_file.media"><span><svg class="text-smd" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!----><strong>media</strong> (<code>str</code> hoặc <code>os.PathLike</code>) — Đường dẫn hoặc URL của video.<!----></span></span></li><!--]--></ul><!--]--> <!--[-1--><!--]--> <!--[0--><div id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexVideoReference.from_file.returns" class="flex items-center font-semibold space-x-3 text-base !mt-0 !mb-0 text-gray-800 rounded "><p class="text-base"><!---->Trả về<!----></p> <!--[0--><!----> | |
| <p><code>PikaH3FlexVideoReference</code></p> | |
| <!----><!--]--> <span class="flex-auto border-t-2 border-gray-100 dark:border-gray-700"></span></div> <div class="text-base"><!----> | |
| <p>các khung hình <code>(num_frames, height, width, 3)</code> <code>uint8</code> với tốc độ khung hình mà container báo cáo, kèm theo âm thanh của nó và tốc độ lấy mẫu của âm thanh đó khi có luồng âm thanh.</p> | |
| <!----></div><!--]--> <!--[-1--><!--]--></div></div><!----> <p>Giải mã tệp video thành <code>PikaH3FlexVideoReference</code>, với độ phân giải, tốc độ khung hình và âm thanh đi kèm.</p> <p>Các tỷ lệ được đặt lên reference, đây chính là mục đích của việc giải mã theo cách này thay vì dùng <a href="/docs/diffusers/main/vi/api/utilities#diffusers.utils.load_video">load_video()</a>: MiniMax-H3 sẽ lấy lại mẫu reference lên 24 fps của chính nó, do đó tỷ lệ khung hình bị mất trong quá trình đưa vào sẽ là một yêu cầu được điều kiện ở tốc độ sai, và không có gì để cảnh báo về điều đó. Một container có metadata sai sẽ được sửa bằng cách ghi đè <code>fps</code> hoặc <code>sample_rate</code> trên reference được trả về.</p> <p>Cần <a href="https://github.com/PyAV-Org/PyAV" rel="nofollow">PyAV</a>.</p></div></div> <!--[1--><h2 class="relative group"><a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->PikaH3FlexAudioReference<!----></span></h2><!--]--><!----> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference"><!----><h3 class="!m-0"><span class="flex-1 break-all md:text-lg bg-gradient-to-r px-2.5 py-1.5 rounded-xl from-indigo-50/70 to-white dark:from-gray-900 dark:to-gray-950 dark:text-indigo-300 text-indigo-700"><svg class="mr-1.5 text-indigo-500 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width=".8em" height=".8em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg><span class="font-light">lớp</span> <span class="font-medium">diffusers.modular_pipelines.pika_h3_flex.</span><span class="font-semibold">PikaH3FlexAudioReference</span></span></h3><!----> <a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/pika_h3_flex/references.py#L174" target="_blank"><span><</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><span class="comma cursor-pointer"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">audio<span class="opacity-60">: Tensor</span></span></span><span class="comma cursor-pointer"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">sample_rate<span class="opacity-60">: int | None = None</span></span></span><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[0--><p class="flex items-center font-semibold !mt-2 !mb-2 text-gray-800">Tham số <span class="flex-auto border-t-2 border-gray-100 dark:border-gray-700 ml-3"></span></p> <ul class="px-2"><!--[--><li class="text-base !pl-4 my-3 rounded "><span class="group flex space-x-1.5 items-start"><a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference.audio" class="header-link block pr-0.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference.audio"><span><svg class="text-smd" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!----><strong>audio</strong> (<code>torch.Tensor</code> có hình dạng <code>(channels, num_samples)</code>) — | |
| Đường sóng tham chiếu, đơn âm hoặc stereo.<!----></span></span></li><li class="text-base !pl-4 my-3 rounded "><span class="group flex space-x-1.5 items-start"><a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference.sample_rate" class="header-link block pr-0.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference.sample_rate"><span><svg class="text-smd" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!----><strong>sample_rate</strong> (<code>int</code>, <em>tùy chọn</em>) — | |
| Tốc độ mà <code>audio</code> mang các mẫu của nó. Nếu bỏ trống, giá trị này sẽ là tốc độ riêng của VAE audio, khiến các mẫu không bị thay đổi; bất kỳ tốc độ nào khác sẽ được lấy mẫu lại lên tốc độ đó.<!----></span></span></li><!--]--></ul><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>Tham chiếu giọng nói hoặc nhạc: tối đa 3 tham chiếu mỗi yêu cầu, và không bao giờ đứng một mình — một tham chiếu âm thanh phải được ghép với ít nhất một tham chiếu hình ảnh hoặc video. Tham chiếu này không bao giờ đến bộ điều kiện (conditioner) và chỉ được mã hóa bởi VAE âm thanh.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference.from_file"><!----><h4 class="!m-0"><span class="flex-1 rounded-xl py-0.5 break-all bg-gradient-to-r from-blue-50/60 to-white dark:from-gray-900 dark:to-gray-950 text-blue-700 dark:text-blue-300 font-medium px-2"><svg width="1em" height="1em" viewBox="0 0 32 33" class="mr-1 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg"><path d="M5.80566 18.3545C4.90766 17.4565 4.90766 16.0005 5.80566 15.1025L14.3768 6.53142C15.2748 5.63342 16.7307 5.63342 17.6287 6.53142L26.1999 15.1025C27.0979 16.0005 27.0979 17.4565 26.1999 18.3545L17.6287 26.9256C16.7307 27.8236 15.2748 27.8236 14.3768 26.9256L5.80566 18.3545Z" fill="currentColor" fill-opacity="0.25"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16.4801 13.9619C16.4801 12.9761 16.7467 12.5436 16.9443 12.3296C17.1764 12.078 17.5731 11.8517 18.2275 11.707C18.8821 11.5623 19.638 11.5342 20.4038 11.5582C20.7804 11.57 21.1341 11.5932 21.4719 11.6156L21.5263 11.6193C21.8195 11.6389 22.1626 11.6618 22.4429 11.6618V7.40825C22.3209 7.40825 22.1219 7.39596 21.7544 7.37149C21.4202 7.34925 20.9976 7.32115 20.5371 7.30672C19.6286 7.27824 18.4672 7.29779 17.3093 7.55377C16.1512 7.8098 14.8404 8.33724 13.8181 9.4452C12.7612 10.5907 12.2266 12.1236 12.2266 13.9619V15.0127H10.6836V19.2662H12.2266V26.6332H16.4801V19.2662H20.3394V15.0127H16.4801V13.9619Z" fill="currentColor"/></svg>from_file</span></h4><!----> <a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference.from_file" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference.from_file"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/pika_h3_flex/references.py#L193" target="_blank"><span><</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><span class="comma cursor-pointer"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">media<span class="opacity-60"></span></span></span><!--]--> <span>)</span> <!--[0--><span class="font-bold">→</span> <span class="rounded hover:bg-gray-400 cursor-pointer"><!----><span><code>PikaH3FlexAudioReference</code></span><!----></span><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[0--><p class="flex items-center font-semibold !mt-2 !mb-2 text-gray-800">Tham số <span class="flex-auto border-t-2 border-gray-100 dark:border-gray-700 ml-3"></span></p> <ul class="px-2"><!--[--><li class="text-base !pl-4 my-3 rounded "><span class="group flex space-x-1.5 items-start"><a id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference.from_file.media" class="header-link block pr-0.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference.from_file.media"><span><svg class="text-smd" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!----><strong>media</strong> (<code>str</code> hoặc <code>os.PathLike</code>) — Đường dẫn hoặc URL của tệp âm thanh, hoặc của tệp video mà bản nhạc nền sẽ được lấy từ đó.<!----></span></span></li><!--]--></ul><!--]--> <!--[-1--><!--]--> <!--[0--><div id="diffusers.modular_pipelines.pika_h3_flex.PikaH3FlexAudioReference.from_file.returns" class="flex items-center font-semibold space-x-3 text-base !mt-0 !mb-0 text-gray-800 rounded "><p class="text-base"><!---->Trả về<!----></p> <!--[0--><!----> | |
| <p><code>PikaH3FlexAudioReference</code></p> | |
| <!----><!--]--> <span class="flex-auto border-t-2 border-gray-100 dark:border-gray-700"></span></div> <div class="text-base"><!----> | |
| <p>waveform float32 có kích thước <code>(channels, num_samples)</code> ở tốc độ lấy mẫu mà container báo cáo.</p> | |
| <!----></div><!--]--> <!--[-1--><!--]--></div></div><!----> <p>Giải mã tệp âm thanh thành <code>PikaH3FlexAudioReference</code>, ở tốc độ lấy mẫu mà tệp mang theo.</p> <p>Cần <a href="https://github.com/PyAV-Org/PyAV" rel="nofollow">PyAV</a>.</p></div></div> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/pika_h3_flex.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg><!----> <span><span class="underline">Update</span> on GitHub</span></a><!----> <p></p><!--]--><!----><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]--> | |
| <script> | |
| { | |
| __sveltekit_g37pnb = { | |
| base: "/docs/diffusers/main/en", | |
| assets: "/docs/diffusers/main/en" | |
| }; | |
| const element = document.currentScript.parentElement; | |
| Promise.all([ | |
| import("/docs/diffusers/main/en/_app/immutable/entry/start.D3LnKZ4R.js"), | |
| import("/docs/diffusers/main/en/_app/immutable/entry/app.C0rBoMxR.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 225], | |
| data: [null,null], | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 112 kB
- Xet hash:
- c9b5535467109a8ce9a8835389148d6858979c65fa4153f39c19334f1b9d8d84
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.