telefuser 0.1.0.post3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (769) hide show
  1. telefuser-0.1.0.post3/.claude/skills/add-new-pipeline/SKILL.md +635 -0
  2. telefuser-0.1.0.post3/.claude/skills/framework-analysis/SKILL.md +120 -0
  3. telefuser-0.1.0.post3/.claude/skills/optimize-pipeline/SKILL.md +668 -0
  4. telefuser-0.1.0.post3/.claude/skills/profile-pipeline/SKILL.md +273 -0
  5. telefuser-0.1.0.post3/.github/ISSUE_TEMPLATE/bug_report.yml +73 -0
  6. telefuser-0.1.0.post3/.github/ISSUE_TEMPLATE/config.yml +11 -0
  7. telefuser-0.1.0.post3/.github/ISSUE_TEMPLATE/feature_request.yml +43 -0
  8. telefuser-0.1.0.post3/.github/ISSUE_TEMPLATE/roadmap.yml +125 -0
  9. telefuser-0.1.0.post3/.github/PULL_REQUEST_TEMPLATE.md +59 -0
  10. telefuser-0.1.0.post3/.github/workflows/docs.yml +66 -0
  11. telefuser-0.1.0.post3/.github/workflows/lint.yml +35 -0
  12. telefuser-0.1.0.post3/.github/workflows/release-pypi.yml +66 -0
  13. telefuser-0.1.0.post3/.github/workflows/release-testpypi.yml +66 -0
  14. telefuser-0.1.0.post3/.github/workflows/test.yml +108 -0
  15. telefuser-0.1.0.post3/.gitignore +153 -0
  16. telefuser-0.1.0.post3/.pre-commit-config.yaml +21 -0
  17. telefuser-0.1.0.post3/AGENTS.md +227 -0
  18. telefuser-0.1.0.post3/CLAUDE.md +227 -0
  19. telefuser-0.1.0.post3/CODE_OF_CONDUCT.md +132 -0
  20. telefuser-0.1.0.post3/CONTRIBUTING.md +387 -0
  21. telefuser-0.1.0.post3/GEMINI.md +227 -0
  22. telefuser-0.1.0.post3/LICENSE +201 -0
  23. telefuser-0.1.0.post3/PKG-INFO +379 -0
  24. telefuser-0.1.0.post3/README.md +287 -0
  25. telefuser-0.1.0.post3/README_zh.md +287 -0
  26. telefuser-0.1.0.post3/assets/telefuser_logo.png +0 -0
  27. telefuser-0.1.0.post3/benchmarks/feature_cache/README.md +188 -0
  28. telefuser-0.1.0.post3/benchmarks/feature_cache/analyze_residual_taylor_error.py +434 -0
  29. telefuser-0.1.0.post3/benchmarks/feature_cache/wan21_1_3b_ada_taylor_cache.py +748 -0
  30. telefuser-0.1.0.post3/benchmarks/kernel/bench_rmsnorm.py +130 -0
  31. telefuser-0.1.0.post3/benchmarks/kernel/bench_rotary.py +108 -0
  32. telefuser-0.1.0.post3/benchmarks/kernel/bench_scale_shift.py +93 -0
  33. telefuser-0.1.0.post3/benchmarks/kernel/run_benchmarks.sh +113 -0
  34. telefuser-0.1.0.post3/docker/.gitkeep +0 -0
  35. telefuser-0.1.0.post3/docs/en/adding_new_example.md +593 -0
  36. telefuser-0.1.0.post3/docs/en/adding_new_model.md +783 -0
  37. telefuser-0.1.0.post3/docs/en/adding_new_stage.md +585 -0
  38. telefuser-0.1.0.post3/docs/en/attention.md +736 -0
  39. telefuser-0.1.0.post3/docs/en/configuration.md +357 -0
  40. telefuser-0.1.0.post3/docs/en/feature_cache.md +310 -0
  41. telefuser-0.1.0.post3/docs/en/hash_config_management.md +519 -0
  42. telefuser-0.1.0.post3/docs/en/index.md +66 -0
  43. telefuser-0.1.0.post3/docs/en/latent_cache.md +424 -0
  44. telefuser-0.1.0.post3/docs/en/logging.md +512 -0
  45. telefuser-0.1.0.post3/docs/en/metrics.md +520 -0
  46. telefuser-0.1.0.post3/docs/en/model_loading.md +237 -0
  47. telefuser-0.1.0.post3/docs/en/offload.md +514 -0
  48. telefuser-0.1.0.post3/docs/en/ops.md +557 -0
  49. telefuser-0.1.0.post3/docs/en/parallel.md +614 -0
  50. telefuser-0.1.0.post3/docs/en/profiler.md +533 -0
  51. telefuser-0.1.0.post3/docs/en/release_pypi.md +78 -0
  52. telefuser-0.1.0.post3/docs/en/service.md +1166 -0
  53. telefuser-0.1.0.post3/docs/en/service_metadata.md +171 -0
  54. telefuser-0.1.0.post3/docs/en/stream_server.md +879 -0
  55. telefuser-0.1.0.post3/docs/en/testing.md +500 -0
  56. telefuser-0.1.0.post3/docs/en/torch_compile_compatibility.md +287 -0
  57. telefuser-0.1.0.post3/docs/requirements.txt +12 -0
  58. telefuser-0.1.0.post3/docs/stylesheets/extra.css +37 -0
  59. telefuser-0.1.0.post3/docs/zh/adding_new_example.md +593 -0
  60. telefuser-0.1.0.post3/docs/zh/adding_new_model.md +782 -0
  61. telefuser-0.1.0.post3/docs/zh/adding_new_stage.md +585 -0
  62. telefuser-0.1.0.post3/docs/zh/adf_scoring_guide.md +479 -0
  63. telefuser-0.1.0.post3/docs/zh/attention.md +736 -0
  64. telefuser-0.1.0.post3/docs/zh/configuration.md +357 -0
  65. telefuser-0.1.0.post3/docs/zh/feature_cache.md +310 -0
  66. telefuser-0.1.0.post3/docs/zh/hash_config_management.md +519 -0
  67. telefuser-0.1.0.post3/docs/zh/index.md +66 -0
  68. telefuser-0.1.0.post3/docs/zh/latent_cache.md +377 -0
  69. telefuser-0.1.0.post3/docs/zh/logging.md +562 -0
  70. telefuser-0.1.0.post3/docs/zh/metrics.md +520 -0
  71. telefuser-0.1.0.post3/docs/zh/model_loading.md +237 -0
  72. telefuser-0.1.0.post3/docs/zh/offload.md +514 -0
  73. telefuser-0.1.0.post3/docs/zh/ops.md +557 -0
  74. telefuser-0.1.0.post3/docs/zh/parallel.md +614 -0
  75. telefuser-0.1.0.post3/docs/zh/profiler.md +481 -0
  76. telefuser-0.1.0.post3/docs/zh/release_pypi.md +74 -0
  77. telefuser-0.1.0.post3/docs/zh/service.md +1164 -0
  78. telefuser-0.1.0.post3/docs/zh/service_metadata.md +169 -0
  79. telefuser-0.1.0.post3/docs/zh/stream_server.md +889 -0
  80. telefuser-0.1.0.post3/docs/zh/testing.md +500 -0
  81. telefuser-0.1.0.post3/docs/zh/torch_compile_compatibility.md +286 -0
  82. telefuser-0.1.0.post3/examples/README.md +208 -0
  83. telefuser-0.1.0.post3/examples/data/1.png +0 -0
  84. telefuser-0.1.0.post3/examples/data/1.wav +0 -0
  85. telefuser-0.1.0.post3/examples/data/101235-video-720_0.png +0 -0
  86. telefuser-0.1.0.post3/examples/data/dag.mp4 +0 -0
  87. telefuser-0.1.0.post3/examples/data/edit2511input.png +0 -0
  88. telefuser-0.1.0.post3/examples/example_config.yaml +230 -0
  89. telefuser-0.1.0.post3/examples/flashvsr/README.md +96 -0
  90. telefuser-0.1.0.post3/examples/flashvsr/flashvsr_stream.py +230 -0
  91. telefuser-0.1.0.post3/examples/flux2_klein/README.md +109 -0
  92. telefuser-0.1.0.post3/examples/flux2_klein/flux2_klein_text_to_image_h100.py +211 -0
  93. telefuser-0.1.0.post3/examples/flux2_klein/flux2_klein_text_to_image_official.py +145 -0
  94. telefuser-0.1.0.post3/examples/hunyuan_video/README.md +158 -0
  95. telefuser-0.1.0.post3/examples/hunyuan_video/hunyuan_video_i2v.py +201 -0
  96. telefuser-0.1.0.post3/examples/hunyuan_video/hunyuan_video_i2v_cache_calibrate.py +244 -0
  97. telefuser-0.1.0.post3/examples/hunyuan_video/hunyuan_video_t2v.py +277 -0
  98. telefuser-0.1.0.post3/examples/hunyuan_video/hunyuan_video_t2v_cache_calibrate.py +235 -0
  99. telefuser-0.1.0.post3/examples/lingbot/stream_lingbot_world_fast.py +83 -0
  100. telefuser-0.1.0.post3/examples/liveact/liveact_s2v_h100.py +176 -0
  101. telefuser-0.1.0.post3/examples/longcat_video/README.md +239 -0
  102. telefuser-0.1.0.post3/examples/longcat_video/longcat_image_to_video.py +207 -0
  103. telefuser-0.1.0.post3/examples/longcat_video/longcat_text_to_video.py +203 -0
  104. telefuser-0.1.0.post3/examples/longcat_video/longcat_text_to_video_refine.py +269 -0
  105. telefuser-0.1.0.post3/examples/longcat_video/longcat_video_continue.py +321 -0
  106. telefuser-0.1.0.post3/examples/longcat_video/longcat_video_unify.py +404 -0
  107. telefuser-0.1.0.post3/examples/ltx_video/README.md +69 -0
  108. telefuser-0.1.0.post3/examples/ltx_video/ltx23_22b_image_to_video_two_stage_h100.py +233 -0
  109. telefuser-0.1.0.post3/examples/qwen_image/README.md +191 -0
  110. telefuser-0.1.0.post3/examples/qwen_image/qwen_image_cache_calibrate.py +225 -0
  111. telefuser-0.1.0.post3/examples/qwen_image/qwen_image_edit_plus_cache_calibrate.py +227 -0
  112. telefuser-0.1.0.post3/examples/qwen_image/qwen_image_edit_plus_h100.py +112 -0
  113. telefuser-0.1.0.post3/examples/qwen_image/qwen_image_edit_plus_official.py +31 -0
  114. telefuser-0.1.0.post3/examples/qwen_image/qwen_image_t2i_h100.py +138 -0
  115. telefuser-0.1.0.post3/examples/qwen_image/qwen_image_t2i_lightning_fp8_h100.py +108 -0
  116. telefuser-0.1.0.post3/examples/qwen_image/qwen_image_t2i_lora_h100.py +115 -0
  117. telefuser-0.1.0.post3/examples/qwen_image/qwen_image_t2i_official.py +52 -0
  118. telefuser-0.1.0.post3/examples/run_examples.py +2069 -0
  119. telefuser-0.1.0.post3/examples/stream_server/stream_arrow_overlay.py +177 -0
  120. telefuser-0.1.0.post3/examples/stream_server/stream_video_replay.py +144 -0
  121. telefuser-0.1.0.post3/examples/stream_server/webrtc_arrow_overlay_demo.py +257 -0
  122. telefuser-0.1.0.post3/examples/stream_server/webrtc_bidirectional_demo.py +1261 -0
  123. telefuser-0.1.0.post3/examples/stream_server/webrtc_client_demo.py +221 -0
  124. telefuser-0.1.0.post3/examples/wan_video/README.md +577 -0
  125. telefuser-0.1.0.post3/examples/wan_video/async_wan22_14b_image_to_video_distill_h100.py +261 -0
  126. telefuser-0.1.0.post3/examples/wan_video/wan21_14b_image_to_video_h100.py +220 -0
  127. telefuser-0.1.0.post3/examples/wan_video/wan21_14b_image_to_video_lora_h100.py +213 -0
  128. telefuser-0.1.0.post3/examples/wan_video/wan21_14b_text_to_video_h100.py +192 -0
  129. telefuser-0.1.0.post3/examples/wan_video/wan21_1_3b_text_to_video_ada_taylor_cache.py +299 -0
  130. telefuser-0.1.0.post3/examples/wan_video/wan21_1_3b_text_to_video_cache_calibrate.py +233 -0
  131. telefuser-0.1.0.post3/examples/wan_video/wan21_1_3b_text_to_video_h100.py +222 -0
  132. telefuser-0.1.0.post3/examples/wan_video/wan21_1_3b_text_to_video_hf.py +202 -0
  133. telefuser-0.1.0.post3/examples/wan_video/wan21_1_3b_text_to_video_radial.py +300 -0
  134. telefuser-0.1.0.post3/examples/wan_video/wan22_14b_first_last_frame_to_video_h100.py +236 -0
  135. telefuser-0.1.0.post3/examples/wan_video/wan22_14b_image_to_video_cache_calibrate.py +270 -0
  136. telefuser-0.1.0.post3/examples/wan_video/wan22_14b_image_to_video_distill_fp8_h100.py +221 -0
  137. telefuser-0.1.0.post3/examples/wan_video/wan22_14b_image_to_video_distill_h100.py +272 -0
  138. telefuser-0.1.0.post3/examples/wan_video/wan22_14b_image_to_video_h100.py +203 -0
  139. telefuser-0.1.0.post3/examples/wan_video/wan22_14b_image_to_video_h100_ray.py +219 -0
  140. telefuser-0.1.0.post3/examples/wan_video/wan22_14b_image_to_video_lora_h100.py +220 -0
  141. telefuser-0.1.0.post3/examples/wan_video/wan22_14b_image_to_video_mix_h100.py +203 -0
  142. telefuser-0.1.0.post3/examples/wan_video/wan22_14b_text_to_video_h100.py +243 -0
  143. telefuser-0.1.0.post3/examples/wan_video/wan22_14b_text_to_video_service.py +282 -0
  144. telefuser-0.1.0.post3/examples/wan_video/wan22_i2v_5b.py +180 -0
  145. telefuser-0.1.0.post3/examples/wan_video/wan22_t2v_5b.py +172 -0
  146. telefuser-0.1.0.post3/examples/z_image/README.md +67 -0
  147. telefuser-0.1.0.post3/examples/z_image/z_image_turbo_official.py +43 -0
  148. telefuser-0.1.0.post3/examples/z_image/z_image_turbo_t2i_h100.py +103 -0
  149. telefuser-0.1.0.post3/mkdocs.yml +216 -0
  150. telefuser-0.1.0.post3/pyproject.toml +249 -0
  151. telefuser-0.1.0.post3/scripts/build_latent_dataset.py +396 -0
  152. telefuser-0.1.0.post3/scripts/build_telefuser_dist.sh +34 -0
  153. telefuser-0.1.0.post3/scripts/publish_telefuser_pypi.sh +15 -0
  154. telefuser-0.1.0.post3/scripts/run_ci_tests.sh +73 -0
  155. telefuser-0.1.0.post3/setup.cfg +7 -0
  156. telefuser-0.1.0.post3/telefuser/__init__.py +6 -0
  157. telefuser-0.1.0.post3/telefuser/_logo.py +12 -0
  158. telefuser-0.1.0.post3/telefuser/_version.py +24 -0
  159. telefuser-0.1.0.post3/telefuser/cache/__init__.py +5 -0
  160. telefuser-0.1.0.post3/telefuser/cache/kv_cache.py +438 -0
  161. telefuser-0.1.0.post3/telefuser/cache_mem/__init__.py +27 -0
  162. telefuser-0.1.0.post3/telefuser/cache_mem/cache_types.py +40 -0
  163. telefuser-0.1.0.post3/telefuser/cache_mem/config.py +83 -0
  164. telefuser-0.1.0.post3/telefuser/cache_mem/connection.py +197 -0
  165. telefuser-0.1.0.post3/telefuser/cache_mem/encoders.py +398 -0
  166. telefuser-0.1.0.post3/telefuser/cache_mem/encoding/__init__.py +0 -0
  167. telefuser-0.1.0.post3/telefuser/cache_mem/encoding/interfaces.py +27 -0
  168. telefuser-0.1.0.post3/telefuser/cache_mem/latent_cache.py +213 -0
  169. telefuser-0.1.0.post3/telefuser/cache_mem/log_monitor.py +77 -0
  170. telefuser-0.1.0.post3/telefuser/cache_mem/metadata.py +268 -0
  171. telefuser-0.1.0.post3/telefuser/cache_mem/src/__init__.py +0 -0
  172. telefuser-0.1.0.post3/telefuser/cache_mem/src/models/__init__.py +0 -0
  173. telefuser-0.1.0.post3/telefuser/cache_mem/src/models/qwen3_vl_embedding.py +346 -0
  174. telefuser-0.1.0.post3/telefuser/cache_mem/src/models/qwen3_vl_reranker.py +437 -0
  175. telefuser-0.1.0.post3/telefuser/cache_mem/state/__init__.py +0 -0
  176. telefuser-0.1.0.post3/telefuser/cache_mem/state/interfaces.py +67 -0
  177. telefuser-0.1.0.post3/telefuser/cache_mem/storage/__init__.py +11 -0
  178. telefuser-0.1.0.post3/telefuser/cache_mem/storage/fluxon.py +24 -0
  179. telefuser-0.1.0.post3/telefuser/cache_mem/storage/interfaces.py +25 -0
  180. telefuser-0.1.0.post3/telefuser/cache_mem/storage/local_file.py +112 -0
  181. telefuser-0.1.0.post3/telefuser/cache_mem/storage/memory.py +24 -0
  182. telefuser-0.1.0.post3/telefuser/cache_mem/strategies.py +819 -0
  183. telefuser-0.1.0.post3/telefuser/cache_mem/vector_store/__init__.py +5 -0
  184. telefuser-0.1.0.post3/telefuser/cache_mem/vector_store/faiss.py +298 -0
  185. telefuser-0.1.0.post3/telefuser/cache_mem/vector_store/interfaces.py +42 -0
  186. telefuser-0.1.0.post3/telefuser/cache_mem/vector_store/qdrant.py +46 -0
  187. telefuser-0.1.0.post3/telefuser/client/__init__.py +34 -0
  188. telefuser-0.1.0.post3/telefuser/client/openai/__init__.py +34 -0
  189. telefuser-0.1.0.post3/telefuser/client/openai/client.py +146 -0
  190. telefuser-0.1.0.post3/telefuser/client/openai/images.py +221 -0
  191. telefuser-0.1.0.post3/telefuser/client/openai/videos.py +307 -0
  192. telefuser-0.1.0.post3/telefuser/client/tf_client.py +1016 -0
  193. telefuser-0.1.0.post3/telefuser/core/__init__.py +37 -0
  194. telefuser-0.1.0.post3/telefuser/core/base_model.py +262 -0
  195. telefuser-0.1.0.post3/telefuser/core/base_pipeline.py +421 -0
  196. telefuser-0.1.0.post3/telefuser/core/base_stage.py +169 -0
  197. telefuser-0.1.0.post3/telefuser/core/config.py +409 -0
  198. telefuser-0.1.0.post3/telefuser/core/config_serializer.py +54 -0
  199. telefuser-0.1.0.post3/telefuser/core/model_registry.py +108 -0
  200. telefuser-0.1.0.post3/telefuser/core/module_manager.py +412 -0
  201. telefuser-0.1.0.post3/telefuser/distributed/__init__.py +95 -0
  202. telefuser-0.1.0.post3/telefuser/distributed/device_mesh.py +347 -0
  203. telefuser-0.1.0.post3/telefuser/distributed/fsdp.py +143 -0
  204. telefuser-0.1.0.post3/telefuser/distributed/parallel_shard.py +250 -0
  205. telefuser-0.1.0.post3/telefuser/distributed/pp_comm.py +306 -0
  206. telefuser-0.1.0.post3/telefuser/distributed/ring.py +357 -0
  207. telefuser-0.1.0.post3/telefuser/distributed/tp_parallelize.py +63 -0
  208. telefuser-0.1.0.post3/telefuser/distributed/ulysses_comm.py +250 -0
  209. telefuser-0.1.0.post3/telefuser/entrypoints/__init__.py +3 -0
  210. telefuser-0.1.0.post3/telefuser/entrypoints/cli/main.py +257 -0
  211. telefuser-0.1.0.post3/telefuser/feature_cache/__init__.py +47 -0
  212. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/__init__.py +28 -0
  213. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/ada_taylor_cache.py +656 -0
  214. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/params/HunyuanVideo15-I2V-480P.json +111 -0
  215. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/params/HunyuanVideo15-T2V-480P.json +111 -0
  216. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/params/Qwen-Image-2512.json +111 -0
  217. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/params/Wan2_1-FL2V-14B-720P.json +89 -0
  218. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/params/Wan2_1-I2V-14B-480P.json +89 -0
  219. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/params/Wan2_1-I2V-14B-720P.json +89 -0
  220. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/params/Wan2_1-T2V-14B.json +109 -0
  221. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/params/Wan2_1-T2V-1_3B.json +109 -0
  222. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/params/Wan2_2-FL2V-A14B.json +89 -0
  223. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/params/Wan2_2-I2V-A14B-Camera.json +109 -0
  224. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/params/Wan2_2-I2V-A14B.json +89 -0
  225. telefuser-0.1.0.post3/telefuser/feature_cache/ada_taylor_cache/params/Wan2_2-T2V-A14B.json +89 -0
  226. telefuser-0.1.0.post3/telefuser/feature_cache/base.py +150 -0
  227. telefuser-0.1.0.post3/telefuser/kernel/__init__.py +55 -0
  228. telefuser-0.1.0.post3/telefuser/kernel/triton/__init__.py +43 -0
  229. telefuser-0.1.0.post3/telefuser/kernel/triton/merge_attn_states.py +115 -0
  230. telefuser-0.1.0.post3/telefuser/kernel/triton/norm.py +816 -0
  231. telefuser-0.1.0.post3/telefuser/kernel/triton/quant.py +147 -0
  232. telefuser-0.1.0.post3/telefuser/kernel/triton/quant_per_block.py +154 -0
  233. telefuser-0.1.0.post3/telefuser/kernel/triton/rotary.py +162 -0
  234. telefuser-0.1.0.post3/telefuser/kernel/triton/scale_shift.py +1064 -0
  235. telefuser-0.1.0.post3/telefuser/kernel/triton/sparse_int8_attn.py +280 -0
  236. telefuser-0.1.0.post3/telefuser/metrics/__init__.py +101 -0
  237. telefuser-0.1.0.post3/telefuser/metrics/collector.py +442 -0
  238. telefuser-0.1.0.post3/telefuser/metrics/config.py +111 -0
  239. telefuser-0.1.0.post3/telefuser/metrics/exporters.py +113 -0
  240. telefuser-0.1.0.post3/telefuser/metrics/registry.py +485 -0
  241. telefuser-0.1.0.post3/telefuser/metrics/service_metrics.py +436 -0
  242. telefuser-0.1.0.post3/telefuser/metrics/stage_metrics.py +207 -0
  243. telefuser-0.1.0.post3/telefuser/models/TCDecoder.py +352 -0
  244. telefuser-0.1.0.post3/telefuser/models/__init__.py +24 -0
  245. telefuser-0.1.0.post3/telefuser/models/flashvsr_dit.py +608 -0
  246. telefuser-0.1.0.post3/telefuser/models/flux2_dit.py +1126 -0
  247. telefuser-0.1.0.post3/telefuser/models/hunyuan_video_byt5.py +433 -0
  248. telefuser-0.1.0.post3/telefuser/models/hunyuan_video_dit.py +2124 -0
  249. telefuser-0.1.0.post3/telefuser/models/hunyuan_video_image_encoder.py +222 -0
  250. telefuser-0.1.0.post3/telefuser/models/hunyuan_video_text_encoder.py +461 -0
  251. telefuser-0.1.0.post3/telefuser/models/hunyuan_video_upsampler.py +320 -0
  252. telefuser-0.1.0.post3/telefuser/models/hunyuan_video_vae.py +850 -0
  253. telefuser-0.1.0.post3/telefuser/models/lingbot_world_fast_dit.py +573 -0
  254. telefuser-0.1.0.post3/telefuser/models/liveact_dit.py +1213 -0
  255. telefuser-0.1.0.post3/telefuser/models/longcat_video_dit.py +1214 -0
  256. telefuser-0.1.0.post3/telefuser/models/ltx_audio_vae.py +1183 -0
  257. telefuser-0.1.0.post3/telefuser/models/ltx_dit.py +2202 -0
  258. telefuser-0.1.0.post3/telefuser/models/ltx_gemma_text_encoder.py +1004 -0
  259. telefuser-0.1.0.post3/telefuser/models/ltx_upsampler.py +416 -0
  260. telefuser-0.1.0.post3/telefuser/models/ltx_video_vae.py +2668 -0
  261. telefuser-0.1.0.post3/telefuser/models/qwen_image_dit.py +780 -0
  262. telefuser-0.1.0.post3/telefuser/models/qwen_image_text_encoder.py +196 -0
  263. telefuser-0.1.0.post3/telefuser/models/qwen_image_vae.py +643 -0
  264. telefuser-0.1.0.post3/telefuser/models/realesrgan.py +356 -0
  265. telefuser-0.1.0.post3/telefuser/models/rift_hdv3.py +353 -0
  266. telefuser-0.1.0.post3/telefuser/models/t5_tokenizer.py +96 -0
  267. telefuser-0.1.0.post3/telefuser/models/video_projector.py +457 -0
  268. telefuser-0.1.0.post3/telefuser/models/wan22_video_vae.py +1548 -0
  269. telefuser-0.1.0.post3/telefuser/models/wan_video_dit.py +1586 -0
  270. telefuser-0.1.0.post3/telefuser/models/wan_video_image_encoder.py +534 -0
  271. telefuser-0.1.0.post3/telefuser/models/wan_video_text_encoder.py +317 -0
  272. telefuser-0.1.0.post3/telefuser/models/wan_video_vae.py +1519 -0
  273. telefuser-0.1.0.post3/telefuser/models/wav2vec2.py +154 -0
  274. telefuser-0.1.0.post3/telefuser/models/xlm_roberta.py +157 -0
  275. telefuser-0.1.0.post3/telefuser/models/z_image_dit.py +695 -0
  276. telefuser-0.1.0.post3/telefuser/models/z_image_text_encoder.py +81 -0
  277. telefuser-0.1.0.post3/telefuser/offload/__init__.py +26 -0
  278. telefuser-0.1.0.post3/telefuser/offload/async_offload.py +417 -0
  279. telefuser-0.1.0.post3/telefuser/offload/model_offload.py +35 -0
  280. telefuser-0.1.0.post3/telefuser/offload/sequential_offload.py +318 -0
  281. telefuser-0.1.0.post3/telefuser/ops/__init__.py +33 -0
  282. telefuser-0.1.0.post3/telefuser/ops/activations.py +187 -0
  283. telefuser-0.1.0.post3/telefuser/ops/attention/__init__.py +29 -0
  284. telefuser-0.1.0.post3/telefuser/ops/attention/attention_impl.py +529 -0
  285. telefuser-0.1.0.post3/telefuser/ops/attention/backends.py +209 -0
  286. telefuser-0.1.0.post3/telefuser/ops/attention/bsa.py +250 -0
  287. telefuser-0.1.0.post3/telefuser/ops/attention/local_sparse_attn.py +547 -0
  288. telefuser-0.1.0.post3/telefuser/ops/attention/sparse_patterns.py +622 -0
  289. telefuser-0.1.0.post3/telefuser/ops/attention/sparse_sage.py +80 -0
  290. telefuser-0.1.0.post3/telefuser/ops/base.py +145 -0
  291. telefuser-0.1.0.post3/telefuser/ops/custom_op.py +121 -0
  292. telefuser-0.1.0.post3/telefuser/ops/ffn.py +69 -0
  293. telefuser-0.1.0.post3/telefuser/ops/fp8_gemm.py +348 -0
  294. telefuser-0.1.0.post3/telefuser/ops/normalization.py +274 -0
  295. telefuser-0.1.0.post3/telefuser/ops/quantized_linear.py +164 -0
  296. telefuser-0.1.0.post3/telefuser/ops/rotary.py +138 -0
  297. telefuser-0.1.0.post3/telefuser/orchestrator/__init__.py +22 -0
  298. telefuser-0.1.0.post3/telefuser/orchestrator/artifact_save_stage.py +119 -0
  299. telefuser-0.1.0.post3/telefuser/orchestrator/pipeline_orchestrator.py +358 -0
  300. telefuser-0.1.0.post3/telefuser/orchestrator/stage_wrapper.py +276 -0
  301. telefuser-0.1.0.post3/telefuser/pipelines/__init__.py +9 -0
  302. telefuser-0.1.0.post3/telefuser/pipelines/common/realesrgan_upscale.py +92 -0
  303. telefuser-0.1.0.post3/telefuser/pipelines/common/rift_vfi.py +54 -0
  304. telefuser-0.1.0.post3/telefuser/pipelines/flashvsr/__init__.py +4 -0
  305. telefuser-0.1.0.post3/telefuser/pipelines/flashvsr/dit_denoising.py +312 -0
  306. telefuser-0.1.0.post3/telefuser/pipelines/flashvsr/flashvsr_stream.py +197 -0
  307. telefuser-0.1.0.post3/telefuser/pipelines/flashvsr/vae.py +57 -0
  308. telefuser-0.1.0.post3/telefuser/pipelines/flux2_klein/__init__.py +5 -0
  309. telefuser-0.1.0.post3/telefuser/pipelines/flux2_klein/dit_denoising.py +329 -0
  310. telefuser-0.1.0.post3/telefuser/pipelines/flux2_klein/pipeline.py +427 -0
  311. telefuser-0.1.0.post3/telefuser/pipelines/flux2_klein/text_encoding.py +201 -0
  312. telefuser-0.1.0.post3/telefuser/pipelines/flux2_klein/vae.py +215 -0
  313. telefuser-0.1.0.post3/telefuser/pipelines/hunyuan_video_1_5/__init__.py +55 -0
  314. telefuser-0.1.0.post3/telefuser/pipelines/hunyuan_video_1_5/dit_denoising.py +270 -0
  315. telefuser-0.1.0.post3/telefuser/pipelines/hunyuan_video_1_5/image_encoding.py +87 -0
  316. telefuser-0.1.0.post3/telefuser/pipelines/hunyuan_video_1_5/pipeline.py +324 -0
  317. telefuser-0.1.0.post3/telefuser/pipelines/hunyuan_video_1_5/sr_dit_denoising.py +363 -0
  318. telefuser-0.1.0.post3/telefuser/pipelines/hunyuan_video_1_5/text_encoding.py +291 -0
  319. telefuser-0.1.0.post3/telefuser/pipelines/hunyuan_video_1_5/upsampler.py +95 -0
  320. telefuser-0.1.0.post3/telefuser/pipelines/hunyuan_video_1_5/vae.py +133 -0
  321. telefuser-0.1.0.post3/telefuser/pipelines/lingbot_world_fast/__init__.py +31 -0
  322. telefuser-0.1.0.post3/telefuser/pipelines/lingbot_world_fast/control.py +208 -0
  323. telefuser-0.1.0.post3/telefuser/pipelines/lingbot_world_fast/denoising.py +85 -0
  324. telefuser-0.1.0.post3/telefuser/pipelines/lingbot_world_fast/pipeline.py +592 -0
  325. telefuser-0.1.0.post3/telefuser/pipelines/lingbot_world_fast/service.py +483 -0
  326. telefuser-0.1.0.post3/telefuser/pipelines/lingbot_world_fast/session.py +76 -0
  327. telefuser-0.1.0.post3/telefuser/pipelines/liveact/__init__.py +16 -0
  328. telefuser-0.1.0.post3/telefuser/pipelines/liveact/audio_encoding.py +365 -0
  329. telefuser-0.1.0.post3/telefuser/pipelines/liveact/denoising.py +306 -0
  330. telefuser-0.1.0.post3/telefuser/pipelines/liveact/pipeline.py +337 -0
  331. telefuser-0.1.0.post3/telefuser/pipelines/longcat_video/__init__.py +12 -0
  332. telefuser-0.1.0.post3/telefuser/pipelines/longcat_video/dit_denoising.py +297 -0
  333. telefuser-0.1.0.post3/telefuser/pipelines/longcat_video/longcat_video.py +542 -0
  334. telefuser-0.1.0.post3/telefuser/pipelines/longcat_video/refine_denoise.py +235 -0
  335. telefuser-0.1.0.post3/telefuser/pipelines/longcat_video/text_encoding.py +118 -0
  336. telefuser-0.1.0.post3/telefuser/pipelines/ltx_video/__init__.py +1 -0
  337. telefuser-0.1.0.post3/telefuser/pipelines/ltx_video/dit_denoising.py +1010 -0
  338. telefuser-0.1.0.post3/telefuser/pipelines/ltx_video/gemma_text_encoding.py +165 -0
  339. telefuser-0.1.0.post3/telefuser/pipelines/ltx_video/ltx23_video.py +518 -0
  340. telefuser-0.1.0.post3/telefuser/pipelines/ltx_video/upsampler.py +29 -0
  341. telefuser-0.1.0.post3/telefuser/pipelines/ltx_video/vae.py +195 -0
  342. telefuser-0.1.0.post3/telefuser/pipelines/qwen_image/__init__.py +11 -0
  343. telefuser-0.1.0.post3/telefuser/pipelines/qwen_image/dit_denoising.py +228 -0
  344. telefuser-0.1.0.post3/telefuser/pipelines/qwen_image/qwen_image.py +301 -0
  345. telefuser-0.1.0.post3/telefuser/pipelines/qwen_image/qwen_image_edit.py +209 -0
  346. telefuser-0.1.0.post3/telefuser/pipelines/qwen_image/text_encoding.py +223 -0
  347. telefuser-0.1.0.post3/telefuser/pipelines/qwen_image/vae.py +91 -0
  348. telefuser-0.1.0.post3/telefuser/pipelines/wan_video/__init__.py +6 -0
  349. telefuser-0.1.0.post3/telefuser/pipelines/wan_video/async_wan22_video.py +467 -0
  350. telefuser-0.1.0.post3/telefuser/pipelines/wan_video/clip_encoding.py +54 -0
  351. telefuser-0.1.0.post3/telefuser/pipelines/wan_video/latent_data_utils.py +53 -0
  352. telefuser-0.1.0.post3/telefuser/pipelines/wan_video/moe_dit_denoising.py +409 -0
  353. telefuser-0.1.0.post3/telefuser/pipelines/wan_video/single_dit_denoising.py +262 -0
  354. telefuser-0.1.0.post3/telefuser/pipelines/wan_video/text_encoding.py +58 -0
  355. telefuser-0.1.0.post3/telefuser/pipelines/wan_video/ti2v_denoising.py +396 -0
  356. telefuser-0.1.0.post3/telefuser/pipelines/wan_video/vae.py +237 -0
  357. telefuser-0.1.0.post3/telefuser/pipelines/wan_video/wan21_video.py +353 -0
  358. telefuser-0.1.0.post3/telefuser/pipelines/wan_video/wan22_ti2v.py +372 -0
  359. telefuser-0.1.0.post3/telefuser/pipelines/wan_video/wan22_video.py +318 -0
  360. telefuser-0.1.0.post3/telefuser/pipelines/z_image/__init__.py +8 -0
  361. telefuser-0.1.0.post3/telefuser/pipelines/z_image/dit_denoising.py +281 -0
  362. telefuser-0.1.0.post3/telefuser/pipelines/z_image/text_encoding.py +117 -0
  363. telefuser-0.1.0.post3/telefuser/pipelines/z_image/vae.py +49 -0
  364. telefuser-0.1.0.post3/telefuser/pipelines/z_image/z_image.py +139 -0
  365. telefuser-0.1.0.post3/telefuser/platforms/__init__.py +80 -0
  366. telefuser-0.1.0.post3/telefuser/platforms/cpu.py +30 -0
  367. telefuser-0.1.0.post3/telefuser/platforms/cuda.py +86 -0
  368. telefuser-0.1.0.post3/telefuser/platforms/interface.py +99 -0
  369. telefuser-0.1.0.post3/telefuser/platforms/npu.py +78 -0
  370. telefuser-0.1.0.post3/telefuser/platforms/rocm.py +72 -0
  371. telefuser-0.1.0.post3/telefuser/schedulers/__init__.py +13 -0
  372. telefuser-0.1.0.post3/telefuser/schedulers/flow_match.py +377 -0
  373. telefuser-0.1.0.post3/telefuser/schedulers/flow_match_discrete.py +325 -0
  374. telefuser-0.1.0.post3/telefuser/schedulers/lcm.py +81 -0
  375. telefuser-0.1.0.post3/telefuser/schedulers/unipc.py +697 -0
  376. telefuser-0.1.0.post3/telefuser/service/__init__.py +38 -0
  377. telefuser-0.1.0.post3/telefuser/service/api/__init__.py +41 -0
  378. telefuser-0.1.0.post3/telefuser/service/api/api_server.py +327 -0
  379. telefuser-0.1.0.post3/telefuser/service/api/middleware.py +334 -0
  380. telefuser-0.1.0.post3/telefuser/service/api/openai/__init__.py +58 -0
  381. telefuser-0.1.0.post3/telefuser/service/api/openai/adapter.py +423 -0
  382. telefuser-0.1.0.post3/telefuser/service/api/openai/image_routes.py +417 -0
  383. telefuser-0.1.0.post3/telefuser/service/api/openai/protocol.py +287 -0
  384. telefuser-0.1.0.post3/telefuser/service/api/openai/video_routes.py +416 -0
  385. telefuser-0.1.0.post3/telefuser/service/api/routers/__init__.py +20 -0
  386. telefuser-0.1.0.post3/telefuser/service/api/routers/files.py +65 -0
  387. telefuser-0.1.0.post3/telefuser/service/api/routers/service.py +143 -0
  388. telefuser-0.1.0.post3/telefuser/service/api/routers/stream.py +88 -0
  389. telefuser-0.1.0.post3/telefuser/service/api/routers/tasks.py +432 -0
  390. telefuser-0.1.0.post3/telefuser/service/api/routers/webrtc.py +164 -0
  391. telefuser-0.1.0.post3/telefuser/service/api/schema.py +80 -0
  392. telefuser-0.1.0.post3/telefuser/service/api/stream_schema.py +76 -0
  393. telefuser-0.1.0.post3/telefuser/service/api/task_contract_runtime.py +148 -0
  394. telefuser-0.1.0.post3/telefuser/service/api/utils.py +139 -0
  395. telefuser-0.1.0.post3/telefuser/service/cache/__init__.py +4 -0
  396. telefuser-0.1.0.post3/telefuser/service/cache/cache_factory.py +176 -0
  397. telefuser-0.1.0.post3/telefuser/service/cache/cache_service.py +389 -0
  398. telefuser-0.1.0.post3/telefuser/service/core/__init__.py +30 -0
  399. telefuser-0.1.0.post3/telefuser/service/core/config.py +249 -0
  400. telefuser-0.1.0.post3/telefuser/service/core/container.py +264 -0
  401. telefuser-0.1.0.post3/telefuser/service/core/contract_templates.py +147 -0
  402. telefuser-0.1.0.post3/telefuser/service/core/file_service.py +269 -0
  403. telefuser-0.1.0.post3/telefuser/service/core/pipeline_contract.py +339 -0
  404. telefuser-0.1.0.post3/telefuser/service/core/pipeline_loader.py +94 -0
  405. telefuser-0.1.0.post3/telefuser/service/core/pipeline_pool.py +280 -0
  406. telefuser-0.1.0.post3/telefuser/service/core/pipeline_runner.py +205 -0
  407. telefuser-0.1.0.post3/telefuser/service/core/pipeline_service.py +311 -0
  408. telefuser-0.1.0.post3/telefuser/service/core/replica_worker.py +298 -0
  409. telefuser-0.1.0.post3/telefuser/service/core/stream_pipeline_service.py +261 -0
  410. telefuser-0.1.0.post3/telefuser/service/core/task_manager.py +416 -0
  411. telefuser-0.1.0.post3/telefuser/service/core/task_processor.py +162 -0
  412. telefuser-0.1.0.post3/telefuser/service/core/task_service.py +156 -0
  413. telefuser-0.1.0.post3/telefuser/service/main.py +99 -0
  414. telefuser-0.1.0.post3/telefuser/service/media/__init__.py +17 -0
  415. telefuser-0.1.0.post3/telefuser/service/media/media_base.py +298 -0
  416. telefuser-0.1.0.post3/telefuser/service/security/__init__.py +32 -0
  417. telefuser-0.1.0.post3/telefuser/service/security/security_validator.py +797 -0
  418. telefuser-0.1.0.post3/telefuser/service/webrtc/__init__.py +32 -0
  419. telefuser-0.1.0.post3/telefuser/service/webrtc/chunk_router.py +111 -0
  420. telefuser-0.1.0.post3/telefuser/service/webrtc/session_manager.py +322 -0
  421. telefuser-0.1.0.post3/telefuser/service/webrtc/track.py +307 -0
  422. telefuser-0.1.0.post3/telefuser/service_types.py +83 -0
  423. telefuser-0.1.0.post3/telefuser/utils/__init__.py +25 -0
  424. telefuser-0.1.0.post3/telefuser/utils/audio.py +51 -0
  425. telefuser-0.1.0.post3/telefuser/utils/func.py +31 -0
  426. telefuser-0.1.0.post3/telefuser/utils/hf_model_analyzer.py +382 -0
  427. telefuser-0.1.0.post3/telefuser/utils/hf_model_utils.py +209 -0
  428. telefuser-0.1.0.post3/telefuser/utils/hf_utils.py +256 -0
  429. telefuser-0.1.0.post3/telefuser/utils/logging.py +749 -0
  430. telefuser-0.1.0.post3/telefuser/utils/lora_loader.py +295 -0
  431. telefuser-0.1.0.post3/telefuser/utils/lora_network.py +212 -0
  432. telefuser-0.1.0.post3/telefuser/utils/memory_snapshot.py +423 -0
  433. telefuser-0.1.0.post3/telefuser/utils/model_weight.py +163 -0
  434. telefuser-0.1.0.post3/telefuser/utils/profiler.py +1079 -0
  435. telefuser-0.1.0.post3/telefuser/utils/stage_bench_harness.py +740 -0
  436. telefuser-0.1.0.post3/telefuser/utils/system.py +228 -0
  437. telefuser-0.1.0.post3/telefuser/utils/torch_compile.py +83 -0
  438. telefuser-0.1.0.post3/telefuser/utils/utils.py +49 -0
  439. telefuser-0.1.0.post3/telefuser/utils/video.py +464 -0
  440. telefuser-0.1.0.post3/telefuser/worker/__init__.py +18 -0
  441. telefuser-0.1.0.post3/telefuser/worker/native_worker.py +125 -0
  442. telefuser-0.1.0.post3/telefuser/worker/parallel_worker.py +292 -0
  443. telefuser-0.1.0.post3/telefuser/worker/ray_worker.py +107 -0
  444. telefuser-0.1.0.post3/telefuser.egg-info/PKG-INFO +379 -0
  445. telefuser-0.1.0.post3/telefuser.egg-info/SOURCES.txt +768 -0
  446. telefuser-0.1.0.post3/telefuser.egg-info/dependency_links.txt +1 -0
  447. telefuser-0.1.0.post3/telefuser.egg-info/entry_points.txt +2 -0
  448. telefuser-0.1.0.post3/telefuser.egg-info/requires.txt +73 -0
  449. telefuser-0.1.0.post3/telefuser.egg-info/scm_file_list.json +763 -0
  450. telefuser-0.1.0.post3/telefuser.egg-info/scm_version.json +8 -0
  451. telefuser-0.1.0.post3/telefuser.egg-info/top_level.txt +1 -0
  452. telefuser-0.1.0.post3/tests/__init__.py +0 -0
  453. telefuser-0.1.0.post3/tests/conftest.py +162 -0
  454. telefuser-0.1.0.post3/tests/integration/conftest.py +161 -0
  455. telefuser-0.1.0.post3/tests/integration/test_pp_forward_consistency.py +228 -0
  456. telefuser-0.1.0.post3/tests/integration/test_service_api.py +380 -0
  457. telefuser-0.1.0.post3/tests/integration/test_stream_api.py +188 -0
  458. telefuser-0.1.0.post3/tests/integration/test_webrtc_api.py +180 -0
  459. telefuser-0.1.0.post3/tests/server/README.md +188 -0
  460. telefuser-0.1.0.post3/tests/server/__init__.py +7 -0
  461. telefuser-0.1.0.post3/tests/server/client/__init__.py +0 -0
  462. telefuser-0.1.0.post3/tests/server/client/test_client.py +241 -0
  463. telefuser-0.1.0.post3/tests/server/conftest.py +114 -0
  464. telefuser-0.1.0.post3/tests/server/fixtures/__init__.py +0 -0
  465. telefuser-0.1.0.post3/tests/server/pipeline/__init__.py +0 -0
  466. telefuser-0.1.0.post3/tests/server/pipeline/fake_t2v_pipeline.py +310 -0
  467. telefuser-0.1.0.post3/tests/server/run_integration_test.py +112 -0
  468. telefuser-0.1.0.post3/tests/server/run_test_server.py +99 -0
  469. telefuser-0.1.0.post3/tests/server/test_middleware.py +345 -0
  470. telefuser-0.1.0.post3/tests/server/test_openai_api.py +438 -0
  471. telefuser-0.1.0.post3/tests/server/test_openai_client.py +409 -0
  472. telefuser-0.1.0.post3/tests/server/test_server.py +306 -0
  473. telefuser-0.1.0.post3/tests/unit/__init__.py +0 -0
  474. telefuser-0.1.0.post3/tests/unit/cache_mem/__init__.py +1 -0
  475. telefuser-0.1.0.post3/tests/unit/cache_mem/test_concurrency.py +355 -0
  476. telefuser-0.1.0.post3/tests/unit/cache_mem/test_metadata.py +150 -0
  477. telefuser-0.1.0.post3/tests/unit/cache_mem/test_storage.py +105 -0
  478. telefuser-0.1.0.post3/tests/unit/cache_mem/test_types_and_config.py +96 -0
  479. telefuser-0.1.0.post3/tests/unit/core/test_base_pipeline.py +225 -0
  480. telefuser-0.1.0.post3/tests/unit/core/test_config.py +161 -0
  481. telefuser-0.1.0.post3/tests/unit/core/test_config_serializer.py +103 -0
  482. telefuser-0.1.0.post3/tests/unit/distributed/__init__.py +0 -0
  483. telefuser-0.1.0.post3/tests/unit/distributed/test_device_mesh.py +270 -0
  484. telefuser-0.1.0.post3/tests/unit/distributed/test_parallel_shard.py +361 -0
  485. telefuser-0.1.0.post3/tests/unit/distributed/test_pp_comm.py +265 -0
  486. telefuser-0.1.0.post3/tests/unit/distributed/test_ulysses_comm.py +164 -0
  487. telefuser-0.1.0.post3/tests/unit/feature_cache/__init__.py +0 -0
  488. telefuser-0.1.0.post3/tests/unit/feature_cache/test_feature_cache.py +644 -0
  489. telefuser-0.1.0.post3/tests/unit/kernel/__init__.py +1 -0
  490. telefuser-0.1.0.post3/tests/unit/kernel/test_rmsnorm.py +325 -0
  491. telefuser-0.1.0.post3/tests/unit/kernel/test_rotary.py +214 -0
  492. telefuser-0.1.0.post3/tests/unit/kernel/test_scale_shift.py +590 -0
  493. telefuser-0.1.0.post3/tests/unit/models/__init__.py +1 -0
  494. telefuser-0.1.0.post3/tests/unit/offload/__init__.py +1 -0
  495. telefuser-0.1.0.post3/tests/unit/offload/test_async_offload.py +387 -0
  496. telefuser-0.1.0.post3/tests/unit/offload/test_sequential_offload.py +250 -0
  497. telefuser-0.1.0.post3/tests/unit/openai/__init__.py +3 -0
  498. telefuser-0.1.0.post3/tests/unit/openai/test_adapter.py +156 -0
  499. telefuser-0.1.0.post3/tests/unit/openai/test_client.py +111 -0
  500. telefuser-0.1.0.post3/tests/unit/openai/test_image_routes.py +154 -0
  501. telefuser-0.1.0.post3/tests/unit/openai/test_integration_server.py +102 -0
  502. telefuser-0.1.0.post3/tests/unit/openai/test_protocol.py +150 -0
  503. telefuser-0.1.0.post3/tests/unit/openai/test_video_routes.py +151 -0
  504. telefuser-0.1.0.post3/tests/unit/ops/test_activations.py +179 -0
  505. telefuser-0.1.0.post3/tests/unit/ops/test_long_context_attention.py +463 -0
  506. telefuser-0.1.0.post3/tests/unit/ops/test_normalization.py +183 -0
  507. telefuser-0.1.0.post3/tests/unit/ops/test_parallel_shard_attention.py +680 -0
  508. telefuser-0.1.0.post3/tests/unit/pipelines/__init__.py +0 -0
  509. telefuser-0.1.0.post3/tests/unit/pipelines/lingbot_world_fast/test_control_alignment.py +62 -0
  510. telefuser-0.1.0.post3/tests/unit/pipelines/wan_video/__init__.py +0 -0
  511. telefuser-0.1.0.post3/tests/unit/pipelines/wan_video/test_latent_data_utils.py +57 -0
  512. telefuser-0.1.0.post3/tests/unit/quantize/__init__.py +1 -0
  513. telefuser-0.1.0.post3/tests/unit/quantize/test_quantized_linear.py +139 -0
  514. telefuser-0.1.0.post3/tests/unit/schedulers/test_flow_match.py +338 -0
  515. telefuser-0.1.0.post3/tests/unit/service/__init__.py +1 -0
  516. telefuser-0.1.0.post3/tests/unit/service/test_config.py +23 -0
  517. telefuser-0.1.0.post3/tests/unit/service/test_pipeline_contract.py +201 -0
  518. telefuser-0.1.0.post3/tests/unit/service/test_pipeline_pool.py +352 -0
  519. telefuser-0.1.0.post3/tests/unit/service/test_schema.py +197 -0
  520. telefuser-0.1.0.post3/tests/unit/service/test_task_contract_runtime.py +45 -0
  521. telefuser-0.1.0.post3/tests/unit/service/test_task_routes.py +116 -0
  522. telefuser-0.1.0.post3/tests/unit/service/test_task_runtime.py +142 -0
  523. telefuser-0.1.0.post3/tests/unit/test_metrics.py +499 -0
  524. telefuser-0.1.0.post3/tests/unit/utils/test_profiler_flags.py +78 -0
  525. telefuser-0.1.0.post3/tests/unit/utils/test_utils.py +198 -0
  526. telefuser-0.1.0.post3/tests/unit/worker/test_parallel_worker.py +378 -0
  527. telefuser-0.1.0.post3/tf-kernel/.clang-format +15 -0
  528. telefuser-0.1.0.post3/tf-kernel/.github/ISSUE_TEMPLATE/bug_report.yml +73 -0
  529. telefuser-0.1.0.post3/tf-kernel/.github/ISSUE_TEMPLATE/feature_request.yml +43 -0
  530. telefuser-0.1.0.post3/tf-kernel/.github/PULL_REQUEST_TEMPLATE.md +58 -0
  531. telefuser-0.1.0.post3/tf-kernel/.github/workflows/docs.yml +80 -0
  532. telefuser-0.1.0.post3/tf-kernel/.github/workflows/lint.yml +65 -0
  533. telefuser-0.1.0.post3/tf-kernel/.gitignore +258 -0
  534. telefuser-0.1.0.post3/tf-kernel/.pre-commit-config.yaml +47 -0
  535. telefuser-0.1.0.post3/tf-kernel/AGENTS.md +126 -0
  536. telefuser-0.1.0.post3/tf-kernel/CLAUDE.md +126 -0
  537. telefuser-0.1.0.post3/tf-kernel/CMakeLists.txt +496 -0
  538. telefuser-0.1.0.post3/tf-kernel/CODE_OF_CONDUCT.md +132 -0
  539. telefuser-0.1.0.post3/tf-kernel/CONTRIBUTING.md +247 -0
  540. telefuser-0.1.0.post3/tf-kernel/Dockerfile +169 -0
  541. telefuser-0.1.0.post3/tf-kernel/GEMINI.md +126 -0
  542. telefuser-0.1.0.post3/tf-kernel/LICENSE +201 -0
  543. telefuser-0.1.0.post3/tf-kernel/Makefile +129 -0
  544. telefuser-0.1.0.post3/tf-kernel/README.md +206 -0
  545. telefuser-0.1.0.post3/tf-kernel/README_zh.md +206 -0
  546. telefuser-0.1.0.post3/tf-kernel/THIRDPARTYNOTICES.txt +488 -0
  547. telefuser-0.1.0.post3/tf-kernel/analyze_whl_kernel_sizes.py +221 -0
  548. telefuser-0.1.0.post3/tf-kernel/benchmark/bench_activation.py +326 -0
  549. telefuser-0.1.0.post3/tf-kernel/benchmark/bench_fp4_gemm.py +399 -0
  550. telefuser-0.1.0.post3/tf-kernel/benchmark/bench_fp8_gemm.py +333 -0
  551. telefuser-0.1.0.post3/tf-kernel/benchmark/bench_int8_gemm.py +295 -0
  552. telefuser-0.1.0.post3/tf-kernel/benchmark/bench_nvfp4_scaled_gemm.py +308 -0
  553. telefuser-0.1.0.post3/tf-kernel/benchmark/bench_per_tensor_quant_fp8.py +225 -0
  554. telefuser-0.1.0.post3/tf-kernel/benchmark/bench_rmsnorm.py +489 -0
  555. telefuser-0.1.0.post3/tf-kernel/benchmark/bench_sageattn2.py +352 -0
  556. telefuser-0.1.0.post3/tf-kernel/build.sh +71 -0
  557. telefuser-0.1.0.post3/tf-kernel/cmake/detect_gpu.cmake +107 -0
  558. telefuser-0.1.0.post3/tf-kernel/cmake/utils.cmake +19 -0
  559. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/block_sparse_attn_api.h +82 -0
  560. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/flash_api.cpp +886 -0
  561. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/alibi.h +63 -0
  562. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/block_info.h +56 -0
  563. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash.h +191 -0
  564. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_blockmask.h +523 -0
  565. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_block_hdim128_bf16_causal_sm80.cu +15 -0
  566. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_block_hdim128_bf16_sm80.cu +15 -0
  567. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_block_hdim128_fp16_causal_sm80.cu +15 -0
  568. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_block_hdim128_fp16_sm80.cu +15 -0
  569. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_block_hdim32_bf16_causal_sm80.cu +15 -0
  570. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_block_hdim32_bf16_sm80.cu +15 -0
  571. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_block_hdim32_fp16_causal_sm80.cu +15 -0
  572. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_block_hdim32_fp16_sm80.cu +15 -0
  573. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_block_hdim64_bf16_causal_sm80.cu +15 -0
  574. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_block_hdim64_bf16_sm80.cu +15 -0
  575. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_block_hdim64_fp16_causal_sm80.cu +15 -0
  576. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_block_hdim64_fp16_sm80.cu +15 -0
  577. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_kernel.h +2132 -0
  578. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_bwd_launch_template.h +259 -0
  579. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_block_hdim128_bf16_causal_sm80.cu +15 -0
  580. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_block_hdim128_bf16_sm80.cu +15 -0
  581. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_block_hdim128_fp16_causal_sm80.cu +15 -0
  582. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_block_hdim128_fp16_sm80.cu +15 -0
  583. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_block_hdim32_bf16_causal_sm80.cu +15 -0
  584. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_block_hdim32_bf16_sm80.cu +15 -0
  585. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_block_hdim32_fp16_causal_sm80.cu +15 -0
  586. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_block_hdim32_fp16_sm80.cu +15 -0
  587. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_block_hdim64_bf16_causal_sm80.cu +15 -0
  588. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_block_hdim64_bf16_sm80.cu +15 -0
  589. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_block_hdim64_fp16_causal_sm80.cu +15 -0
  590. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_block_hdim64_fp16_sm80.cu +15 -0
  591. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_kernel.h +1477 -0
  592. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/flash_fwd_launch_template.h +138 -0
  593. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/hardware_info.h +39 -0
  594. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/kernel_traits.h +357 -0
  595. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/kernel_traits_sm90.h +147 -0
  596. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/namespace_config.h +67 -0
  597. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/philox.cuh +155 -0
  598. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/softmax.h +363 -0
  599. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/static_switch.h +51 -0
  600. telefuser-0.1.0.post3/tf-kernel/csrc/block_sparse_attn/src/utils.h +482 -0
  601. telefuser-0.1.0.post3/tf-kernel/csrc/common_extension.cc +410 -0
  602. telefuser-0.1.0.post3/tf-kernel/csrc/cutlass_extensions/common.hpp +21 -0
  603. telefuser-0.1.0.post3/tf-kernel/csrc/cutlass_extensions/detail/collective/mixed_input_utils.hpp +482 -0
  604. telefuser-0.1.0.post3/tf-kernel/csrc/cutlass_extensions/epilogue/epilogue_per_row_per_col_scale.h +309 -0
  605. telefuser-0.1.0.post3/tf-kernel/csrc/cutlass_extensions/gemm/collective/builders/sm90_gmma_builder_mixed_input.inl +278 -0
  606. telefuser-0.1.0.post3/tf-kernel/csrc/cutlass_extensions/gemm/collective/collective_builder_mixed_input.hpp +52 -0
  607. telefuser-0.1.0.post3/tf-kernel/csrc/cutlass_extensions/gemm/collective/collective_mma_array_mixed_input.hpp +53 -0
  608. telefuser-0.1.0.post3/tf-kernel/csrc/cutlass_extensions/gemm/collective/sm90_mma_array_tma_gmma_rs_warpspecialized_mixed_input_.hpp +1538 -0
  609. telefuser-0.1.0.post3/tf-kernel/csrc/cutlass_extensions/gemm/cutlass_gemm_caller.cuh +62 -0
  610. telefuser-0.1.0.post3/tf-kernel/csrc/cutlass_extensions/gemm/dispatch_policy.hpp +38 -0
  611. telefuser-0.1.0.post3/tf-kernel/csrc/cutlass_extensions/gemm/fp8_blockwise_gemm_sm90_dispatch.cuh +197 -0
  612. telefuser-0.1.0.post3/tf-kernel/csrc/cutlass_extensions/gemm/gemm_universal_base_compat.h +356 -0
  613. telefuser-0.1.0.post3/tf-kernel/csrc/cutlass_extensions/gemm/gemm_with_epilogue_visitor.h +492 -0
  614. telefuser-0.1.0.post3/tf-kernel/csrc/elementwise/activation.cu +170 -0
  615. telefuser-0.1.0.post3/tf-kernel/csrc/elementwise/cast.cu +170 -0
  616. telefuser-0.1.0.post3/tf-kernel/csrc/elementwise/concat_mla.cu +217 -0
  617. telefuser-0.1.0.post3/tf-kernel/csrc/elementwise/copy.cu +58 -0
  618. telefuser-0.1.0.post3/tf-kernel/csrc/elementwise/fused_add_rms_norm_kernel.cu +59 -0
  619. telefuser-0.1.0.post3/tf-kernel/csrc/elementwise/pos_enc.cu +208 -0
  620. telefuser-0.1.0.post3/tf-kernel/csrc/elementwise/pos_enc.cuh +467 -0
  621. telefuser-0.1.0.post3/tf-kernel/csrc/elementwise/rope.cu +168 -0
  622. telefuser-0.1.0.post3/tf-kernel/csrc/elementwise/topk.cu +545 -0
  623. telefuser-0.1.0.post3/tf-kernel/csrc/elementwise/utils.cuh +72 -0
  624. telefuser-0.1.0.post3/tf-kernel/csrc/expert_specialization/es_fp8_blockwise.cu +167 -0
  625. telefuser-0.1.0.post3/tf-kernel/csrc/expert_specialization/es_fp8_blockwise_functor.cuh +268 -0
  626. telefuser-0.1.0.post3/tf-kernel/csrc/expert_specialization/es_fp8_blockwise_launcher.cuh +284 -0
  627. telefuser-0.1.0.post3/tf-kernel/csrc/expert_specialization/es_fp8_blockwise_traits.cuh +174 -0
  628. telefuser-0.1.0.post3/tf-kernel/csrc/expert_specialization/es_sm100_mxfp8_blockscaled.cu +40 -0
  629. telefuser-0.1.0.post3/tf-kernel/csrc/expert_specialization/es_sm100_mxfp8_blockscaled_functor.cuh +134 -0
  630. telefuser-0.1.0.post3/tf-kernel/csrc/expert_specialization/es_sm100_mxfp8_blockscaled_group_quant.cu +39 -0
  631. telefuser-0.1.0.post3/tf-kernel/csrc/expert_specialization/es_sm100_mxfp8_blockscaled_group_quant.cuh +407 -0
  632. telefuser-0.1.0.post3/tf-kernel/csrc/expert_specialization/es_sm100_mxfp8_blockscaled_launcher.cuh +214 -0
  633. telefuser-0.1.0.post3/tf-kernel/csrc/expert_specialization/es_sm100_mxfp8_blockscaled_traits.cuh +131 -0
  634. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/bmm_fp8.cu +75 -0
  635. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/fp8_blockwise_gemm_kernel.cu +465 -0
  636. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/fp8_gemm_kernel.cu +1532 -0
  637. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/int8_gemm_kernel.cu +747 -0
  638. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/math.hpp +28 -0
  639. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/nvfp4_expert_quant.cu +728 -0
  640. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/nvfp4_quant.cuh +182 -0
  641. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/nvfp4_quant_entry.cu +77 -0
  642. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/nvfp4_quant_kernels.cu +242 -0
  643. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/nvfp4_scaled_mm_entry.cu +64 -0
  644. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/nvfp4_scaled_mm_kernels.cu +687 -0
  645. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/per_tensor_quant_fp8.cu +123 -0
  646. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/per_token_group_quant_8bit.cu +217 -0
  647. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/per_token_group_quant_8bit_v2.cu +514 -0
  648. telefuser-0.1.0.post3/tf-kernel/csrc/gemm/per_token_quant_fp8.cu +314 -0
  649. telefuser-0.1.0.post3/tf-kernel/csrc/memory/store.cu +147 -0
  650. telefuser-0.1.0.post3/tf-kernel/csrc/memory/weak_ref_tensor.cpp +35 -0
  651. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/cp_async.cuh +154 -0
  652. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/dispatch_utils.h +111 -0
  653. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/fused/fused.cu +1094 -0
  654. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/fused/fused.h +70 -0
  655. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/math.cuh +157 -0
  656. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/mma.cuh +665 -0
  657. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/numeric_conversion.cuh +151 -0
  658. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/permuted_smem.cuh +195 -0
  659. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/attn_cuda_sm80.h +75 -0
  660. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/attn_cuda_sm89.h +169 -0
  661. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/attn_cuda_sm90.h +49 -0
  662. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/attn_utils.cuh +972 -0
  663. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/qk_int_sv_f16_cuda_sm80.cu +1563 -0
  664. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/qk_int_sv_f8_cuda_sm89.cuh +841 -0
  665. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/qk_int_sv_f8_cuda_sm90.cu +967 -0
  666. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/sm89_qk_int8_sv_f8_accum_f16_attn_inst_buf.cu +201 -0
  667. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/sm89_qk_int8_sv_f8_accum_f16_fuse_v_scale_attn_inst_buf.cu +207 -0
  668. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/sm89_qk_int8_sv_f8_accum_f32_attn.cu +201 -0
  669. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/sm89_qk_int8_sv_f8_accum_f32_attn_inst_buf.cu +200 -0
  670. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/sm89_qk_int8_sv_f8_accum_f32_fuse_v_scale_attn.cu +207 -0
  671. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/sm89_qk_int8_sv_f8_accum_f32_fuse_v_scale_attn_inst_buf.cu +207 -0
  672. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/qattn/sm89_qk_int8_sv_f8_accum_f32_fuse_v_scale_fuse_v_mean_attn.cu +213 -0
  673. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/reduction_utils.cuh +182 -0
  674. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/utils.cuh +40 -0
  675. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn2/wgmma.cuh +653 -0
  676. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/__init__.py +16 -0
  677. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/api.h +28 -0
  678. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/api.py +152 -0
  679. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/api.cu +353 -0
  680. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/block_info.h +69 -0
  681. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/blockscaled_layout.h +141 -0
  682. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/cute_extension.h +371 -0
  683. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/epilogue_tma_ws.h +209 -0
  684. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/kernel_traits.h +195 -0
  685. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/kernel_ws.h +210 -0
  686. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/launch.h +103 -0
  687. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/mainloop_tma_ws.h +919 -0
  688. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/named_barrier.h +117 -0
  689. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/params.h +179 -0
  690. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/softmax_fused.h +167 -0
  691. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/static_switch.h +83 -0
  692. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/tile_scheduler.h +270 -0
  693. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/blackwell/utils.h +408 -0
  694. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/quantization/cuda_utils.h +49 -0
  695. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/quantization/fp4_quantization_4d.cu +658 -0
  696. telefuser-0.1.0.post3/tf-kernel/csrc/sageattn3/setup.py +187 -0
  697. telefuser-0.1.0.post3/tf-kernel/docs/Makefile +27 -0
  698. telefuser-0.1.0.post3/tf-kernel/docs/source/api/attention.rst +30 -0
  699. telefuser-0.1.0.post3/tf-kernel/docs/source/api/elementwise.rst +37 -0
  700. telefuser-0.1.0.post3/tf-kernel/docs/source/api/gemm.rst +46 -0
  701. telefuser-0.1.0.post3/tf-kernel/docs/source/api/index.rst +25 -0
  702. telefuser-0.1.0.post3/tf-kernel/docs/source/conf.py +77 -0
  703. telefuser-0.1.0.post3/tf-kernel/docs/source/contributing.rst +50 -0
  704. telefuser-0.1.0.post3/tf-kernel/docs/source/development.rst +147 -0
  705. telefuser-0.1.0.post3/tf-kernel/docs/source/index.rst +38 -0
  706. telefuser-0.1.0.post3/tf-kernel/docs/source/installation.rst +96 -0
  707. telefuser-0.1.0.post3/tf-kernel/docs/source/quickstart.rst +91 -0
  708. telefuser-0.1.0.post3/tf-kernel/include/pytorch_extension_utils_rocm.h +20 -0
  709. telefuser-0.1.0.post3/tf-kernel/include/scalar_type.hpp +331 -0
  710. telefuser-0.1.0.post3/tf-kernel/include/tf_kernel_ops.h +240 -0
  711. telefuser-0.1.0.post3/tf-kernel/include/tf_kernel_torch_shim.h +122 -0
  712. telefuser-0.1.0.post3/tf-kernel/include/utils.h +469 -0
  713. telefuser-0.1.0.post3/tf-kernel/kernel-runner-setup.sh +150 -0
  714. telefuser-0.1.0.post3/tf-kernel/pyproject.toml +114 -0
  715. telefuser-0.1.0.post3/tf-kernel/pytest.ini +16 -0
  716. telefuser-0.1.0.post3/tf-kernel/rename_wheels.sh +91 -0
  717. telefuser-0.1.0.post3/tf-kernel/scripts/check_wheel_symbols.py +272 -0
  718. telefuser-0.1.0.post3/tf-kernel/tests/conftest.py +14 -0
  719. telefuser-0.1.0.post3/tf-kernel/tests/test_activation.py +40 -0
  720. telefuser-0.1.0.post3/tf-kernel/tests/test_block_sparse_attn.py +628 -0
  721. telefuser-0.1.0.post3/tf-kernel/tests/test_block_sparse_attn_simple.py +156 -0
  722. telefuser-0.1.0.post3/tf-kernel/tests/test_bmm_fp8.py +44 -0
  723. telefuser-0.1.0.post3/tf-kernel/tests/test_copy.py +16 -0
  724. telefuser-0.1.0.post3/tf-kernel/tests/test_fp4_gemm.py +163 -0
  725. telefuser-0.1.0.post3/tf-kernel/tests/test_fp4_quantize.py +268 -0
  726. telefuser-0.1.0.post3/tf-kernel/tests/test_fp8_blockwise_gemm.py +92 -0
  727. telefuser-0.1.0.post3/tf-kernel/tests/test_fp8_gemm.py +50 -0
  728. telefuser-0.1.0.post3/tf-kernel/tests/test_int8_gemm.py +49 -0
  729. telefuser-0.1.0.post3/tf-kernel/tests/test_norm.py +77 -0
  730. telefuser-0.1.0.post3/tf-kernel/tests/test_sageattn2.py +295 -0
  731. telefuser-0.1.0.post3/tf-kernel/tests/test_sageattn3.py +209 -0
  732. telefuser-0.1.0.post3/tf-kernel/tests/test_torch_defaults_reset.py +16 -0
  733. telefuser-0.1.0.post3/tf-kernel/tests/utils.py +16 -0
  734. telefuser-0.1.0.post3/tf-kernel/tf_kernel/__init__.py +71 -0
  735. telefuser-0.1.0.post3/tf-kernel/tf_kernel/block_sparse_attn.py +438 -0
  736. telefuser-0.1.0.post3/tf-kernel/tf_kernel/elementwise.py +350 -0
  737. telefuser-0.1.0.post3/tf-kernel/tf_kernel/gemm.py +415 -0
  738. telefuser-0.1.0.post3/tf-kernel/tf_kernel/load_utils.py +260 -0
  739. telefuser-0.1.0.post3/tf-kernel/tf_kernel/memory.py +26 -0
  740. telefuser-0.1.0.post3/tf-kernel/tf_kernel/sageattn2.py +1693 -0
  741. telefuser-0.1.0.post3/tf-kernel/tf_kernel/sageattn3.py +316 -0
  742. telefuser-0.1.0.post3/tf-kernel/tf_kernel/sampling.py +544 -0
  743. telefuser-0.1.0.post3/tf-kernel/tf_kernel/scalar_type.py +352 -0
  744. telefuser-0.1.0.post3/tf-kernel/tf_kernel/test_utils.py +125 -0
  745. telefuser-0.1.0.post3/tf-kernel/tf_kernel/testing/__init__.py +0 -0
  746. telefuser-0.1.0.post3/tf-kernel/tf_kernel/testing/rotary_embedding.py +244 -0
  747. telefuser-0.1.0.post3/tf-kernel/tf_kernel/triton/__init__.py +0 -0
  748. telefuser-0.1.0.post3/tf-kernel/tf_kernel/triton/attn_qk_int8_block_varlen.py +244 -0
  749. telefuser-0.1.0.post3/tf-kernel/tf_kernel/triton/attn_qk_int8_per_block.py +320 -0
  750. telefuser-0.1.0.post3/tf-kernel/tf_kernel/triton/attn_qk_int8_per_block_causal.py +290 -0
  751. telefuser-0.1.0.post3/tf-kernel/tf_kernel/triton/attn_qk_int8_per_block_causal_varlen.py +276 -0
  752. telefuser-0.1.0.post3/tf-kernel/tf_kernel/triton/quant_per_block.py +166 -0
  753. telefuser-0.1.0.post3/tf-kernel/tf_kernel/triton/quant_per_block_varlen.py +158 -0
  754. telefuser-0.1.0.post3/tf-kernel/tf_kernel/triton/quant_per_thread.py +369 -0
  755. telefuser-0.1.0.post3/tf-kernel/tf_kernel/utils.py +45 -0
  756. telefuser-0.1.0.post3/tools/convert/README.md +382 -0
  757. telefuser-0.1.0.post3/tools/convert/converter.py +937 -0
  758. telefuser-0.1.0.post3/tools/convert/lora_extractor.py +504 -0
  759. telefuser-0.1.0.post3/tools/convert/lora_loader.py +451 -0
  760. telefuser-0.1.0.post3/tools/convert/quant.py +145 -0
  761. telefuser-0.1.0.post3/tools/convert/register.py +47 -0
  762. telefuser-0.1.0.post3/tools/deploy/README.md +15 -0
  763. telefuser-0.1.0.post3/tools/deploy/docker_monitor.py +945 -0
  764. telefuser-0.1.0.post3/tools/deploy/multi_device_communication_test.py +429 -0
  765. telefuser-0.1.0.post3/tools/deploy/show_stat.py +993 -0
  766. telefuser-0.1.0.post3/tools/viewer/README.md +198 -0
  767. telefuser-0.1.0.post3/tools/viewer/weight_viewer.py +512 -0
  768. telefuser-0.1.0.post3/webui/__init__.py +0 -0
  769. telefuser-0.1.0.post3/webui/stream_app.py +191 -0
@@ -0,0 +1,635 @@
1
+ ---
2
+ name: add-new-pipeline
3
+ description: Guide for integrating external project pipelines into TeleFuser. Six-phase workflow with interactive checkpoints.
4
+ ---
5
+
6
+ # Add New Pipeline Integration Guide
7
+
8
+ ## Trigger Conditions
9
+
10
+ - User requests to integrate a new model/pipeline from external project
11
+ - User mentions "integrate xxx into telefuser"
12
+
13
+ ---
14
+
15
+ ## Workflow Overview
16
+
17
+ ```
18
+ Phase 1 → Phase 2.1 → Phase 2.2 → Phase 3 → Phase 4 → Phase 5
19
+ Analyze Pipeline Stages Models Cleanup Review
20
+ ↓ ↓ ↓ ↓ ↓ ↓
21
+ Checkpoint Checkpoint Checkpoint Checkpoint Checkpoint Done
22
+ ```
23
+
24
+ **Each phase ends with AskUserQuestion checkpoint - wait for approval before proceeding.**
25
+
26
+ ---
27
+
28
+ ## Phase 1: Analyze Original Pipeline
29
+
30
+ ### Goals
31
+ 1. Understand model architecture by reading source code
32
+ 2. Document pipeline logic and inference flow
33
+ 3. Create analysis reports
34
+
35
+ ### Key Tasks
36
+
37
+ 1. **Read pipeline entry point** - Trace `__call__` method execution flow
38
+ 2. **Read model definitions** - Go deep to actual class implementations (DiT, VAE, Text Encoder)
39
+ 3. **Create analysis reports** in `examples/<model_name>/analysis/`:
40
+ - `PIPELINE_LOGIC.md` - Entry point, execution steps, key functions
41
+ - `MODEL_DEFINITION.md` - Architecture, configuration, class hierarchy
42
+ - `INFERENCE_LOGIC.md` - Forward flow, data transformations
43
+
44
+ ### Progress Tracking
45
+
46
+ Create `examples/<model_name>/PROGRESS.md`:
47
+
48
+ ```markdown
49
+ # [Model Name] Integration Progress
50
+
51
+ ## Overview
52
+ - **Model**: [Name]
53
+ - **Type**: [T2V/I2V/T2I/SR]
54
+ - **Started**: [Date]
55
+
56
+ ## Phase Status
57
+ | Phase | Status | Notes |
58
+ |-------|--------|-------|
59
+ | 1. Analyze | 🔄 In Progress | |
60
+ | 2.1 Pipeline | ⏳ Pending | |
61
+ | 2.2 Stages | ⏳ Pending | |
62
+ | 3. Integrate | ⏳ Pending | |
63
+ | 4. Cleanup | ⏳ Pending | |
64
+ | 5. Review | ⏳ Pending | |
65
+
66
+ ## Key Findings
67
+ - Architecture patterns: ...
68
+ - Special handling required: ...
69
+ - Implementation challenges: ...
70
+ ```
71
+
72
+ ### Model Source Rules
73
+
74
+ | Component | Integration Method |
75
+ |-----------|-------------------|
76
+ | **DiT/Transformer** | Source-level (`telefuser/models/<model>_dit.py`, inherit `BaseModel`) |
77
+ | VAE | `module_manager.load_from_huggingface()` |
78
+ | Text Encoder | `module_manager.load_from_huggingface()` |
79
+ | Scheduler | Use existing or HuggingFace |
80
+
81
+ ### 🛑 Phase 1 Checkpoint
82
+
83
+ After completion:
84
+ 1. Show analysis report summaries
85
+ 2. Highlight critical findings (unique patterns, challenges)
86
+ 3. **AskUserQuestion**: "Phase 1 complete. Ready for Phase 2.1?"
87
+
88
+ ---
89
+
90
+ ## Phase 2.1: Minimal Pipeline Integration (Faithful Copy)
91
+
92
+ ### Goals
93
+ 1. Create Pipeline class with **faithful copy** of original pipeline logic
94
+ 2. Initialize models externally using ModuleManager
95
+ 3. Verify pipeline can be instantiated and run
96
+
97
+ ### ⚠️ CRITICAL: Faithful Copy Requirements for Pipeline
98
+
99
+ **Same rules as model integration apply to pipeline code:**
100
+
101
+ | Prohibited | Example |
102
+ |------------|---------|
103
+ | ❌ Modify any logic | Change computation order |
104
+ | ❌ Add/remove operations | Add preprocessing steps |
105
+ | ❌ Change parameter names | Rename `num_frames` to `frame_num` |
106
+ | ❌ "Optimize" code | Refactor loops, merge functions |
107
+
108
+ | Allowed | Description |
109
+ |---------|-------------|
110
+ | ✅ Change inheritance | Inherit `BasePipeline` |
111
+ | ✅ Add type annotations | Parameter and return types |
112
+ | ✅ Adjust imports | Use TeleFuser imports |
113
+ | ✅ Use ModuleManager | `self.dit = module_manager.fetch_module("dit")` |
114
+
115
+ ### Files to Create
116
+
117
+ ```
118
+ telefuser/pipelines/<model_name>/
119
+ ├── __init__.py
120
+ └── pipeline.py # Pipeline class - faithful copy of original
121
+ ```
122
+
123
+ ### Pipeline Template
124
+
125
+ ```python
126
+ # telefuser/pipelines/<model_name>/pipeline.py
127
+ from telefuser.core.base_pipeline import BasePipeline
128
+ from telefuser.core.module_manager import ModuleManager
129
+
130
+ class MyModelPipeline(BasePipeline):
131
+ """Pipeline for MyModel - faithful copy from original project."""
132
+
133
+ def __init__(self, device="cuda", torch_dtype=torch.bfloat16):
134
+ super().__init__(device=device, torch_dtype=torch_dtype)
135
+ # Division factors for resolution
136
+ self.height_division_factor = 16
137
+ self.width_division_factor = 16
138
+
139
+ def init(self, module_manager: ModuleManager, config: MyModelConfig):
140
+ """Initialize pipeline with external modules."""
141
+ self._model_info = module_manager.get_model_info()
142
+ self.config = config
143
+
144
+ # Fetch modules from ModuleManager (added externally)
145
+ self.dit = module_manager.fetch_module("dit")
146
+ self.vae = module_manager.fetch_module("vae")
147
+ self.text_encoder = module_manager.fetch_module("text_encoder")
148
+
149
+ def __call__(self, prompt: str, ...):
150
+ """Forward pass - FAITHFUL COPY of original pipeline logic.
151
+
152
+ DO NOT modify:
153
+ - Computation order
154
+ - Parameter names
155
+ - Math formulas
156
+ - Control flow
157
+ """
158
+ # Copy original __call__ logic exactly
159
+ ...
160
+ ```
161
+
162
+ ### Example File Template
163
+
164
+ Create `examples/<model_name>/<model>_<task>_<hardware>.py`:
165
+
166
+ ```python
167
+ """Example for MyModel pipeline integration.
168
+
169
+ This example shows how to:
170
+ 1. Initialize models externally
171
+ 2. Add them to ModuleManager
172
+ 3. Create and run the pipeline
173
+ """
174
+
175
+ import torch
176
+ from telefuser.core.module_manager import ModuleManager
177
+ from telefuser.pipelines.<model_name> import MyModelPipeline, MyModelConfig
178
+
179
+ PPL_CONFIG = dict(
180
+ name="<model>_<task>_<hardware>",
181
+ num_inference_steps=50,
182
+ cfg_scale=4.0,
183
+ )
184
+
185
+
186
+ def get_pipeline(
187
+ model_root: str,
188
+ device: str = "cuda",
189
+ torch_dtype: torch.dtype = torch.bfloat16,
190
+ ):
191
+ """Initialize pipeline with external model loading."""
192
+
193
+ # 1. Create ModuleManager
194
+ mm = ModuleManager(torch_dtype=torch_dtype, device="cpu")
195
+
196
+ # 2. Load models EXTERNALLY (not inside pipeline)
197
+ # DiT - source-level model
198
+ dit_path = f"{model_root}/dit.safetensors"
199
+ mm.load_model(dit_path, name="dit", torch_dtype=torch_dtype)
200
+
201
+ # VAE - HuggingFace loading
202
+ vae_path = f"{model_root}/vae"
203
+ mm.load_from_huggingface(
204
+ vae_path,
205
+ module_source="diffusers",
206
+ module_class=AutoencoderKL,
207
+ module_name="vae",
208
+ )
209
+
210
+ # Text Encoder
211
+ text_encoder_path = f"{model_root}/text_encoder"
212
+ mm.load_from_huggingface(
213
+ text_encoder_path,
214
+ module_source="transformers",
215
+ module_class=T5EncoderModel,
216
+ module_name="text_encoder",
217
+ )
218
+
219
+ # 3. Create pipeline
220
+ pipeline = MyModelPipeline(device=device, torch_dtype=torch_dtype)
221
+
222
+ # 4. Initialize pipeline with external modules
223
+ config = MyModelConfig()
224
+ pipeline.init(mm, config)
225
+
226
+ return pipeline
227
+
228
+
229
+ def run(pipeline, prompt: str, ...):
230
+ """Run inference."""
231
+ with torch.inference_mode():
232
+ output = pipeline(prompt=prompt, ...)
233
+ return output
234
+
235
+
236
+ @click.command()
237
+ @click.option("--model_root", required=True)
238
+ @click.option("--prompt", required=True)
239
+ def main(model_root, prompt):
240
+ pipeline = get_pipeline(model_root)
241
+ output = run(pipeline, prompt)
242
+ print(f"Generated: {output}")
243
+
244
+
245
+ if __name__ == "__main__":
246
+ main()
247
+ ```
248
+
249
+ ### Verification
250
+
251
+ After creating pipeline:
252
+
253
+ ```bash
254
+ # Compare original pipeline with integrated version
255
+ diff -u <original_pipeline.py> telefuser/pipelines/<model>/pipeline.py
256
+
257
+ # Ensure only allowed differences:
258
+ # - import statements
259
+ # - class inheritance (BasePipeline)
260
+ # - type annotations
261
+ # - ModuleManager.fetch_module() calls
262
+ ```
263
+
264
+ ### 🛑 Phase 2.1 Checkpoint
265
+
266
+ After completion:
267
+ 1. Show `pipeline.py` - highlight it's a faithful copy
268
+ 2. Show example file with external model initialization
269
+ 3. **Run diff comparison**
270
+ 4. **AskUserQuestion**: "Phase 2.1 complete. Pipeline is faithful copy. Ready for Phase 2.2?"
271
+
272
+ ---
273
+
274
+ ## Phase 2.2: Split Pipeline into Stages (Faithful Copy)
275
+
276
+ ### Goals
277
+ 1. Split pipeline `__call__` into separate Stage classes
278
+ 2. Each stage inherits `BaseStage`
279
+ 3. **NO logic modification** - just code organization
280
+
281
+ ### ⚠️ CRITICAL: Stage Splitting Rules
282
+
283
+ **Stages are for code organization, NOT refactoring:**
284
+
285
+ | Prohibited | Reason |
286
+ |------------|--------|
287
+ | ❌ Change computation order | Breaks correctness |
288
+ | ❌ Add/remove operations | Breaks correctness |
289
+ | ❌ Modify stage interfaces | Breaks data flow |
290
+ | ❌ "Optimize" within stages | Introduces bugs |
291
+
292
+ | Allowed | Description |
293
+ |---------|-------------|
294
+ | ✅ Group related operations | e.g., all text encoding in one stage |
295
+ | ✅ Use BaseStage decorators | `@with_model_offload`, `@torch.inference_mode` |
296
+ | ✅ Pass data between stages | Via method parameters |
297
+
298
+ ### Files Structure
299
+
300
+ ```
301
+ telefuser/pipelines/<model_name>/
302
+ ├── __init__.py
303
+ ├── pipeline.py # Pipeline class (updated to use stages)
304
+ ├── text_encoding.py # Text encoding stage
305
+ ├── vae.py # VAE encode/decode stage
306
+ ├── denoising.py # DiT denoising stage
307
+ └── <other>_stage.py # Other stages as needed
308
+ ```
309
+
310
+ ### Stage Template
311
+
312
+ ```python
313
+ # telefuser/pipelines/<model_name>/text_encoding.py
314
+ from telefuser.core.base_stage import BaseStage, with_model_offload
315
+ from telefuser.core.module_manager import ModuleManager
316
+
317
+ class TextEncodingStage(BaseStage):
318
+ """Text encoding stage - faithful copy from original pipeline."""
319
+
320
+ def __init__(self, name: str, module_manager: ModuleManager, config):
321
+ super().__init__(name, config)
322
+ self.text_encoder = module_manager.fetch_module("text_encoder")
323
+ self.model_names = ["text_encoder"]
324
+
325
+ @with_model_offload(["text_encoder"])
326
+ @torch.inference_mode()
327
+ def process(self, prompts: list[str]) -> torch.Tensor:
328
+ """Encode text prompts.
329
+
330
+ FAITHFUL COPY of original encoding logic - DO NOT MODIFY.
331
+ """
332
+ # Copy exact logic from original pipeline
333
+ text_embeddings = self.text_encoder(prompts)
334
+ return text_embeddings
335
+ ```
336
+
337
+ ### Updated Pipeline Using Stages
338
+
339
+ ```python
340
+ # telefuser/pipelines/<model_name>/pipeline.py
341
+ class MyModelPipeline(BasePipeline):
342
+
343
+ def init(self, module_manager: ModuleManager, config: MyModelConfig):
344
+ self._model_info = module_manager.get_model_info()
345
+ self.config = config
346
+
347
+ # Create stages
348
+ self.text_encoding_stage = TextEncodingStage(
349
+ "text_encoding", module_manager, config.text_encoding_config
350
+ )
351
+ self.vae_stage = VAEStage(
352
+ "vae", module_manager, config.vae_config
353
+ )
354
+ self.denoising_stage = DenoisingStage(
355
+ "denoising", module_manager, config.dit_config
356
+ )
357
+
358
+ def __call__(self, prompt: str, ...):
359
+ """Forward pass using stages - SAME LOGIC as original."""
360
+ # Stage 1: Text encoding
361
+ text_embeddings = self.text_encoding_stage.process([prompt])
362
+
363
+ # Stage 2: VAE encoding
364
+ latents = self.vae_stage.encode(image)
365
+
366
+ # Stage 3: Denoising
367
+ latents = self.denoising_stage.process(latents, text_embeddings, ...)
368
+
369
+ # Stage 4: VAE decoding
370
+ output = self.vae_stage.decode(latents)
371
+
372
+ return output
373
+ ```
374
+
375
+ ### Verification Checklist
376
+
377
+ After splitting into stages:
378
+
379
+ ```markdown
380
+ | Check Item | Pass? |
381
+ |------------|-------|
382
+ | Computation order identical | □ |
383
+ | All operations preserved | □ |
384
+ | Parameter passing correct | □ |
385
+ | Output matches original | □ |
386
+ ```
387
+
388
+ ### 🛑 Phase 2.2 Checkpoint
389
+
390
+ After completion:
391
+ 1. Show all stage files
392
+ 2. Show updated pipeline.py
393
+ 3. **Run verification checklist**
394
+ 4. **AskUserQuestion**: "Phase 2.2 complete. Stages are faithful copies. Ready for Phase 3?"
395
+
396
+ ---
397
+
398
+ ## Phase 3: Integrate Internal Models
399
+
400
+ ### Goals
401
+ 1. Implement DiT model at source-level (inherit `BaseModel`)
402
+ 2. Implement `state_dict_converter()` for loading pretrained weights
403
+ 3. Verify model loads correctly
404
+
405
+ ### ⚠️ CRITICAL: Faithful Copy Requirements
406
+
407
+ **When integrating model code from external projects, strictly follow these rules:**
408
+
409
+ #### 1. Prohibited Modifications
410
+
411
+ | Prohibited Operation | Example | Reason |
412
+ |---------------------|---------|--------|
413
+ | ❌ Add/remove tensor operations | `x.flatten(2)`, `x.view()` | Changes data flow |
414
+ | ❌ Change parameter passing | `e0[0]` instead of `e0` | Changes parameter meaning |
415
+ | ❌ Modify math formulas | `x = x + y` → `x = x + y * e` | Incorrect computation logic |
416
+ | ❌ Merge/split functions | Combine multiple attention | Changes semantics |
417
+ | ❌ "Optimize" code structure | Refactor, simplify | Introduces bugs |
418
+ | ❌ Modify logic branches | Change conditionals | Inconsistent behavior |
419
+
420
+ #### 2. Allowed Modifications
421
+
422
+ | Allowed Operation | Description |
423
+ |-------------------|-------------|
424
+ | ✅ Change inheritance | `ModelMixin` → `BaseModel` |
425
+ | ✅ Add type annotations | `def forward(x)` → `def forward(x: torch.Tensor)` |
426
+ | ✅ Adjust import paths | Relative → Absolute imports |
427
+ | ✅ Remove external dependencies | Like `diffusers`, `transformers` mixin classes |
428
+ | ✅ Add `state_dict_converter()` | Weight loading adaptation |
429
+ | ✅ Add docstrings | English comments |
430
+
431
+ #### 3. Verification Steps
432
+
433
+ **After copying each class, MUST execute:**
434
+
435
+ ```bash
436
+ # Compare original and integrated file differences
437
+ diff -u <original_file> <integrated_file> | grep "^[-+]" | grep -v "^[-+][-+][-+]"
438
+
439
+ # Ensure only these types of differences:
440
+ # - import statements
441
+ # - class inheritance declaration
442
+ # - type annotations
443
+ # - docstrings
444
+ ```
445
+
446
+ **Difference Verification Checklist:**
447
+
448
+ ```markdown
449
+ | Check Item | Pass? |
450
+ |------------|-------|
451
+ | forward() logic identical | □ |
452
+ | Parameter names and order identical | □ |
453
+ | Tensor operation calls identical | □ |
454
+ | Math formulas identical | □ |
455
+ | Conditional branches identical | □ |
456
+ ```
457
+
458
+ #### 4. Model Configuration Parameters
459
+
460
+ **⚠️ CRITICAL: Never guess default parameters - always verify with user!**
461
+
462
+ When the original model uses `from_pretrained()` (diffusers `ModelMixin`) or reads from `config.json`, the model parameters are determined by the checkpoint's config file, NOT hardcoded defaults.
463
+
464
+ | Wrong Approach | Correct Approach |
465
+ |----------------|------------------|
466
+ | ❌ Copy default values from original code | ✅ Ask user for actual config from checkpoint |
467
+ | ❌ Use generic defaults (dim=2048, num_heads=16) | ✅ Get dim, ffn_dim, num_heads, num_layers from config.json |
468
+ | ❌ Assume parameters work with weights | ✅ Verify parameters match weight tensor shapes |
469
+
470
+ **Example: LiveAct config.json shows:**
471
+ ```json
472
+ {
473
+ "dim": 5120,
474
+ "ffn_dim": 13824,
475
+ "num_heads": 40,
476
+ "num_layers": 40,
477
+ "in_dim": 36
478
+ }
479
+ ```
480
+
481
+ If using wrong defaults (dim=2048, num_heads=16), weight loading will fail with shape mismatch errors.
482
+
483
+ **Required Action:**
484
+ When implementing model `__init__`, **AskUserQuestion** to request:
485
+ 1. `config.json` content from checkpoint directory
486
+ 2. Or key parameters: `dim`, `ffn_dim`, `num_heads`, `num_layers`, `in_dim`, etc.
487
+ 3. Update default parameter values to match actual checkpoint config
488
+
489
+ #### 5. Correct vs Incorrect Example
490
+
491
+ ```python
492
+ # ❌ WRONG - Unnecessary "optimization"
493
+ def forward(self, x, grid_sizes, freqs):
494
+ q = causal_rope_apply(x.flatten(2), grid_sizes, freqs) # Wrongly added flatten
495
+ q = q.view(B, -1, self.num_heads, self.head_dim)
496
+
497
+ # ✅ CORRECT - Faithful copy
498
+ def forward(self, x, grid_sizes, freqs):
499
+ q = causal_rope_apply(x, grid_sizes, freqs) # Identical to original
500
+ q = q.transpose(1, 2)
501
+ ```
502
+
503
+ ### DiT Model Implementation
504
+
505
+ ```python
506
+ # telefuser/models/<model>_dit.py
507
+ from telefuser.core.base_model import BaseModel
508
+
509
+ class MyModelDiT(BaseModel):
510
+ def __init__(self, config: MyModelDiTConfig):
511
+ super().__init__()
512
+ # Directly copy from original - DO NOT modify
513
+ self.x_embedder = nn.Linear(...)
514
+ self.transformer_blocks = nn.ModuleList([...])
515
+
516
+ def forward(self, hidden_states, timestep, encoder_hidden_states, ...):
517
+ # Directly copy from original - DO NOT modify logic
518
+ ...
519
+
520
+ def get_fsdp_module_names(self) -> list[str]:
521
+ return ["TransformerBlock", "SingleTransformerBlock"]
522
+
523
+ @staticmethod
524
+ def state_dict_converter():
525
+ return MyModelDiTStateDictConverter()
526
+
527
+
528
+ class MyModelDiTStateDictConverter:
529
+ def from_diffusers(self, state_dict: dict) -> dict:
530
+ return state_dict # or key remapping
531
+
532
+ def from_official(self, state_dict: dict) -> dict:
533
+ # Key remapping from official/BFL format
534
+ ...
535
+ ```
536
+
537
+ ### Loading in Pipeline
538
+
539
+ ```python
540
+ # DiT - source-level
541
+ transformer = Flux2DiT.from_pretrained(transformer_path, torch_dtype)
542
+ mm.add_module(transformer, "transformer")
543
+
544
+ # VAE/TextEncoder - HuggingFace loading
545
+ mm.load_from_huggingface(vae_path, module_source="diffusers",
546
+ module_class=AutoencoderKLFlux2, module_name="vae")
547
+ mm.load_from_huggingface(text_encoder_path, module_source="transformers",
548
+ module_class=Qwen3ForCausalLM, module_name="text_encoder")
549
+ ```
550
+
551
+ ### 🛑 Phase 3 Checkpoint
552
+
553
+ After completion:
554
+ 1. Show `<model>_dit.py` implementation
555
+ 2. Show state_dict_converter
556
+ 3. **Run diff comparison and show results**
557
+ 4. **AskUserQuestion**: "Phase 3 complete. Ready for Phase 4?"
558
+
559
+ ---
560
+
561
+ ## Phase 4: Code Cleanup
562
+
563
+ ### Remove
564
+ - `gradient_checkpointing` attributes
565
+ - `self.training` conditionals
566
+ - Duplicate definitions (RMSNorm, swish, etc.)
567
+ - Unused code
568
+
569
+ ### Standardize
570
+ - Consistent `from_pretrained` parameter names
571
+ - Encoders return dataclass (not dict)
572
+ - Shared utilities in single location
573
+
574
+ ### 🛑 Phase 4 Checkpoint
575
+
576
+ After completion:
577
+ 1. Run `pre-commit run --all-files`
578
+ 2. Show cleanup summary
579
+ 3. Update PROGRESS.md status
580
+ 4. **AskUserQuestion**: "Phase 4 complete. Ready for Phase 5?"
581
+
582
+ ---
583
+
584
+ ## Phase 5: Review & Compare
585
+
586
+ ### Goals
587
+ 1. Compare pipeline logic with original
588
+ 2. Verify edge case handling
589
+ 3. Ensure numerical output matches
590
+
591
+ ### Comparison Checklist
592
+
593
+ | Aspect | Check |
594
+ |--------|-------|
595
+ | Pipeline flow | Steps match original? |
596
+ | Edge cases | CFG=1, batch>1, custom sizes? |
597
+ | Model config | Parameters match? |
598
+ | Numerical | Output matches original? |
599
+
600
+ Create `examples/<model_name>/COMPARISON_REPORT.md` with findings.
601
+
602
+ ### 🛑 Phase 5 Checkpoint
603
+
604
+ After completion:
605
+ 1. Show comparison summary
606
+ 2. Highlight any mismatches
607
+ 3. If issues: provide fix suggestions
608
+ 4. **AskUserQuestion**: "Integration complete. What next?"
609
+
610
+ ---
611
+
612
+ ## Skip Handling
613
+
614
+ When user says "skip X":
615
+ - Skip the work, NOT the checkpoint
616
+ - Still analyze from code if skipping execution
617
+ - Still use AskUserQuestion for approval
618
+
619
+ ---
620
+
621
+ ## Context Management
622
+
623
+ Phase 2.2 and 3 are critical and need precision. If context is exhausted after earlier phases, recommend starting a fresh session.
624
+
625
+ ---
626
+
627
+ ## Related Documentation
628
+
629
+ | Topic | Document |
630
+ |-------|----------|
631
+ | Model Implementation | `docs/en/adding_new_model.md` |
632
+ | Stage Implementation | `docs/en/adding_new_stage.md` |
633
+ | Attention Config | `docs/en/attention.md` |
634
+ | Parallel Inference | `docs/en/parallel.md` |
635
+ | Optimization | Use `/optimize-pipeline` skill after integration |