tico 0.2.0__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 (605) hide show
  1. tico-0.2.0/LICENSE +241 -0
  2. tico-0.2.0/PKG-INFO +422 -0
  3. tico-0.2.0/README.md +165 -0
  4. tico-0.2.0/pyproject.toml +52 -0
  5. tico-0.2.0/setup.cfg +4 -0
  6. tico-0.2.0/tico/__init__.py +63 -0
  7. tico-0.2.0/tico/_version.py +1 -0
  8. tico-0.2.0/tico/circle/__init__.py +82 -0
  9. tico-0.2.0/tico/circle/_object.py +237 -0
  10. tico-0.2.0/tico/circle/_schema.py +104 -0
  11. tico-0.2.0/tico/circle/analysis/__init__.py +32 -0
  12. tico-0.2.0/tico/circle/analysis/effects.py +364 -0
  13. tico-0.2.0/tico/circle/analysis/purity.py +161 -0
  14. tico-0.2.0/tico/circle/analysis/structural_hash.py +135 -0
  15. tico-0.2.0/tico/circle/analysis/tensor_contract.py +266 -0
  16. tico-0.2.0/tico/circle/builder.py +857 -0
  17. tico-0.2.0/tico/circle/cli/__init__.py +17 -0
  18. tico-0.2.0/tico/circle/cli/__main__.py +17 -0
  19. tico-0.2.0/tico/circle/cli/main.py +510 -0
  20. tico-0.2.0/tico/circle/document.py +149 -0
  21. tico-0.2.0/tico/circle/errors.py +33 -0
  22. tico-0.2.0/tico/circle/export.py +187 -0
  23. tico-0.2.0/tico/circle/graph.py +348 -0
  24. tico-0.2.0/tico/circle/inspect/__init__.py +28 -0
  25. tico-0.2.0/tico/circle/inspect/printer.py +124 -0
  26. tico-0.2.0/tico/circle/inspect/summary.py +111 -0
  27. tico-0.2.0/tico/circle/io.py +179 -0
  28. tico-0.2.0/tico/circle/mutation.py +354 -0
  29. tico-0.2.0/tico/circle/operations/__init__.py +29 -0
  30. tico-0.2.0/tico/circle/operations/extract.py +229 -0
  31. tico-0.2.0/tico/circle/passes/__init__.py +105 -0
  32. tico-0.2.0/tico/circle/passes/base.py +142 -0
  33. tico-0.2.0/tico/circle/passes/cleanup/__init__.py +23 -0
  34. tico-0.2.0/tico/circle/passes/cleanup/compact_indices.py +53 -0
  35. tico-0.2.0/tico/circle/passes/cleanup/dead_code_elimination.py +135 -0
  36. tico-0.2.0/tico/circle/passes/cleanup/graph_inputs.py +139 -0
  37. tico-0.2.0/tico/circle/passes/manager.py +142 -0
  38. tico-0.2.0/tico/circle/passes/optimization/__init__.py +59 -0
  39. tico-0.2.0/tico/circle/passes/optimization/_pattern_utils.py +294 -0
  40. tico-0.2.0/tico/circle/passes/optimization/_utils.py +565 -0
  41. tico-0.2.0/tico/circle/passes/optimization/canonicalize/__init__.py +20 -0
  42. tico-0.2.0/tico/circle/passes/optimization/canonicalize/equivalent_ops.py +778 -0
  43. tico-0.2.0/tico/circle/passes/optimization/compatibility/__init__.py +32 -0
  44. tico-0.2.0/tico/circle/passes/optimization/compatibility/custom_ops.py +649 -0
  45. tico-0.2.0/tico/circle/passes/optimization/compatibility/fc_gelu_fc.py +672 -0
  46. tico-0.2.0/tico/circle/passes/optimization/cse.py +281 -0
  47. tico-0.2.0/tico/circle/passes/optimization/fold/__init__.py +47 -0
  48. tico-0.2.0/tico/circle/passes/optimization/fold/constant_subgraph.py +739 -0
  49. tico-0.2.0/tico/circle/passes/optimization/fold/evaluators/__init__.py +111 -0
  50. tico-0.2.0/tico/circle/passes/optimization/fold/evaluators/base.py +207 -0
  51. tico-0.2.0/tico/circle/passes/optimization/fold/evaluators/elementwise.py +325 -0
  52. tico-0.2.0/tico/circle/passes/optimization/fold/evaluators/heavy.py +890 -0
  53. tico-0.2.0/tico/circle/passes/optimization/fold/evaluators/indexing.py +129 -0
  54. tico-0.2.0/tico/circle/passes/optimization/fold/evaluators/shape.py +315 -0
  55. tico-0.2.0/tico/circle/passes/optimization/fold/profiles.py +99 -0
  56. tico-0.2.0/tico/circle/passes/optimization/fuse/__init__.py +40 -0
  57. tico-0.2.0/tico/circle/passes/optimization/fuse/activation.py +241 -0
  58. tico-0.2.0/tico/circle/passes/optimization/fuse/composite.py +1594 -0
  59. tico-0.2.0/tico/circle/passes/optimization/fuse/linear.py +1219 -0
  60. tico-0.2.0/tico/circle/passes/optimization/fuse/requantize.py +200 -0
  61. tico-0.2.0/tico/circle/passes/optimization/fuse/spatial.py +543 -0
  62. tico-0.2.0/tico/circle/passes/optimization/legalize/__init__.py +24 -0
  63. tico-0.2.0/tico/circle/passes/optimization/legalize/dynamic_fully_connected.py +460 -0
  64. tico-0.2.0/tico/circle/passes/optimization/policy.py +30 -0
  65. tico-0.2.0/tico/circle/passes/optimization/simplify/__init__.py +39 -0
  66. tico-0.2.0/tico/circle/passes/optimization/simplify/_layout_utils.py +105 -0
  67. tico-0.2.0/tico/circle/passes/optimization/simplify/arithmetic.py +743 -0
  68. tico-0.2.0/tico/circle/passes/optimization/simplify/identity_ops.py +573 -0
  69. tico-0.2.0/tico/circle/passes/optimization/simplify/reductions.py +547 -0
  70. tico-0.2.0/tico/circle/passes/optimization/simplify/transpose_region.py +888 -0
  71. tico-0.2.0/tico/circle/passes/optimization/simplify/transpose_region_rules.py +1416 -0
  72. tico-0.2.0/tico/circle/passes/optimization/simplify/views.py +1127 -0
  73. tico-0.2.0/tico/circle/passes/presets.py +327 -0
  74. tico-0.2.0/tico/circle/passes/rules.py +534 -0
  75. tico-0.2.0/tico/circle/passes/worklist.py +113 -0
  76. tico-0.2.0/tico/circle/rewrite.py +668 -0
  77. tico-0.2.0/tico/circle/selector.py +146 -0
  78. tico-0.2.0/tico/circle/session.py +452 -0
  79. tico-0.2.0/tico/circle/value/__init__.py +32 -0
  80. tico-0.2.0/tico/circle/value/codec.py +223 -0
  81. tico-0.2.0/tico/circle/value/dtype.py +212 -0
  82. tico-0.2.0/tico/circle/value/tensor.py +240 -0
  83. tico-0.2.0/tico/circle/verify.py +491 -0
  84. tico-0.2.0/tico/config/__init__.py +4 -0
  85. tico-0.2.0/tico/config/base.py +37 -0
  86. tico-0.2.0/tico/config/factory.py +41 -0
  87. tico-0.2.0/tico/config/v1.py +43 -0
  88. tico-0.2.0/tico/experimental/__init__.py +1 -0
  89. tico-0.2.0/tico/interpreter/__init__.py +1 -0
  90. tico-0.2.0/tico/interpreter/infer.py +64 -0
  91. tico-0.2.0/tico/interpreter/interpreter.py +103 -0
  92. tico-0.2.0/tico/ops/__init__.py +21 -0
  93. tico-0.2.0/tico/ops/concat.py +51 -0
  94. tico-0.2.0/tico/ops/resize_bilinear.py +119 -0
  95. tico-0.2.0/tico/ops/same_padding_conv2d.py +203 -0
  96. tico-0.2.0/tico/passes/__init__.py +1 -0
  97. tico-0.2.0/tico/passes/cast_aten_where_arg_type.py +191 -0
  98. tico-0.2.0/tico/passes/cast_clamp_mixed_type_args.py +192 -0
  99. tico-0.2.0/tico/passes/cast_mixed_type_args.py +189 -0
  100. tico-0.2.0/tico/passes/const_prop_pass.py +629 -0
  101. tico-0.2.0/tico/passes/convert_conv1d_to_conv2d.py +160 -0
  102. tico-0.2.0/tico/passes/convert_conv3d_to_conv2d.py +423 -0
  103. tico-0.2.0/tico/passes/convert_expand_to_slice_cat.py +153 -0
  104. tico-0.2.0/tico/passes/convert_gather_to_gather_nd.py +350 -0
  105. tico-0.2.0/tico/passes/convert_layout_op_to_reshape.py +108 -0
  106. tico-0.2.0/tico/passes/convert_matmul_to_linear.py +312 -0
  107. tico-0.2.0/tico/passes/convert_repeat_to_expand_copy.py +89 -0
  108. tico-0.2.0/tico/passes/convert_sym_size_to_circle_shape.py +99 -0
  109. tico-0.2.0/tico/passes/convert_to_relu6.py +181 -0
  110. tico-0.2.0/tico/passes/decompose_addmm.py +121 -0
  111. tico-0.2.0/tico/passes/decompose_batch_norm.py +196 -0
  112. tico-0.2.0/tico/passes/decompose_fake_quantize.py +150 -0
  113. tico-0.2.0/tico/passes/decompose_fake_quantize_tensor_qparams.py +297 -0
  114. tico-0.2.0/tico/passes/decompose_group_norm.py +272 -0
  115. tico-0.2.0/tico/passes/decompose_grouped_conv2d.py +209 -0
  116. tico-0.2.0/tico/passes/decompose_slice_scatter.py +169 -0
  117. tico-0.2.0/tico/passes/eliminate_rank_round_trip_region.py +853 -0
  118. tico-0.2.0/tico/passes/extract_dtype_kwargs.py +122 -0
  119. tico-0.2.0/tico/passes/fill_meta_val.py +57 -0
  120. tico-0.2.0/tico/passes/fuse_leading_unsqueeze_reshape.py +112 -0
  121. tico-0.2.0/tico/passes/fuse_redundant_reshape_to_mean.py +102 -0
  122. tico-0.2.0/tico/passes/legalize_causal_mask_value.py +109 -0
  123. tico-0.2.0/tico/passes/legalize_predefined_layout_operators.py +596 -0
  124. tico-0.2.0/tico/passes/lower_copy.py +95 -0
  125. tico-0.2.0/tico/passes/lower_pow2_to_mul.py +75 -0
  126. tico-0.2.0/tico/passes/lower_to_resize_nearest_neighbor.py +235 -0
  127. tico-0.2.0/tico/passes/lower_to_slice.py +230 -0
  128. tico-0.2.0/tico/passes/merge_consecutive_cat.py +80 -0
  129. tico-0.2.0/tico/passes/ops.py +85 -0
  130. tico-0.2.0/tico/passes/remove_nop.py +84 -0
  131. tico-0.2.0/tico/passes/remove_redundant_assert_nodes.py +53 -0
  132. tico-0.2.0/tico/passes/remove_redundant_expand.py +63 -0
  133. tico-0.2.0/tico/passes/remove_redundant_permute.py +122 -0
  134. tico-0.2.0/tico/passes/remove_redundant_reshape.py +438 -0
  135. tico-0.2.0/tico/passes/remove_redundant_slice.py +62 -0
  136. tico-0.2.0/tico/passes/remove_redundant_to_copy.py +86 -0
  137. tico-0.2.0/tico/passes/remove_unused_placeholder.py +130 -0
  138. tico-0.2.0/tico/passes/restore_linear.py +115 -0
  139. tico-0.2.0/tico/passes/segment_index_select.py +145 -0
  140. tico-0.2.0/tico/pt2_to_circle.py +105 -0
  141. tico-0.2.0/tico/quantization/__init__.py +10 -0
  142. tico-0.2.0/tico/quantization/algorithm/__init__.py +1 -0
  143. tico-0.2.0/tico/quantization/algorithm/adaround/__init__.py +121 -0
  144. tico-0.2.0/tico/quantization/algorithm/adaround/discrete_refinement.py +1522 -0
  145. tico-0.2.0/tico/quantization/algorithm/adaround/global_refinement.py +1987 -0
  146. tico-0.2.0/tico/quantization/algorithm/adaround/joint.py +779 -0
  147. tico-0.2.0/tico/quantization/algorithm/adaround/joint_runner.py +632 -0
  148. tico-0.2.0/tico/quantization/algorithm/adaround/rounding.py +498 -0
  149. tico-0.2.0/tico/quantization/algorithm/adaround/runner.py +499 -0
  150. tico-0.2.0/tico/quantization/algorithm/adaround/screened_refinement.py +1008 -0
  151. tico-0.2.0/tico/quantization/algorithm/block_reconstruction/__init__.py +81 -0
  152. tico-0.2.0/tico/quantization/algorithm/block_reconstruction/cache.py +355 -0
  153. tico-0.2.0/tico/quantization/algorithm/block_reconstruction/multistart.py +394 -0
  154. tico-0.2.0/tico/quantization/algorithm/block_reconstruction/observer.py +440 -0
  155. tico-0.2.0/tico/quantization/algorithm/block_reconstruction/qdrop.py +287 -0
  156. tico-0.2.0/tico/quantization/algorithm/block_reconstruction/runner.py +648 -0
  157. tico-0.2.0/tico/quantization/algorithm/block_reconstruction/selection.py +149 -0
  158. tico-0.2.0/tico/quantization/algorithm/cle/__init__.py +1 -0
  159. tico-0.2.0/tico/quantization/algorithm/cle/cle.py +375 -0
  160. tico-0.2.0/tico/quantization/algorithm/cle/quantizer.py +74 -0
  161. tico-0.2.0/tico/quantization/algorithm/fpi_gptq/__init__.py +1 -0
  162. tico-0.2.0/tico/quantization/algorithm/fpi_gptq/fpi_gptq.py +229 -0
  163. tico-0.2.0/tico/quantization/algorithm/fpi_gptq/quantizer.py +186 -0
  164. tico-0.2.0/tico/quantization/algorithm/fpi_gptq/util.py +56 -0
  165. tico-0.2.0/tico/quantization/algorithm/gemma4_gptq/__init__.py +1 -0
  166. tico-0.2.0/tico/quantization/algorithm/gemma4_gptq/gptq.py +42 -0
  167. tico-0.2.0/tico/quantization/algorithm/gemma4_gptq/quantizer.py +1064 -0
  168. tico-0.2.0/tico/quantization/algorithm/gemma4_gptq/utils.py +219 -0
  169. tico-0.2.0/tico/quantization/algorithm/gptq/__init__.py +1 -0
  170. tico-0.2.0/tico/quantization/algorithm/gptq/gptq.py +473 -0
  171. tico-0.2.0/tico/quantization/algorithm/gptq/quant.py +329 -0
  172. tico-0.2.0/tico/quantization/algorithm/gptq/quantizer.py +511 -0
  173. tico-0.2.0/tico/quantization/algorithm/gptq/utils.py +224 -0
  174. tico-0.2.0/tico/quantization/algorithm/qwen3_vl_gptq/__init__.py +1 -0
  175. tico-0.2.0/tico/quantization/algorithm/qwen3_vl_gptq/gptq.py +564 -0
  176. tico-0.2.0/tico/quantization/algorithm/qwen3_vl_gptq/quantizer.py +850 -0
  177. tico-0.2.0/tico/quantization/algorithm/qwen3_vl_gptq/utils.py +699 -0
  178. tico-0.2.0/tico/quantization/algorithm/smoothquant/__init__.py +1 -0
  179. tico-0.2.0/tico/quantization/algorithm/smoothquant/observer.py +96 -0
  180. tico-0.2.0/tico/quantization/algorithm/smoothquant/quantizer.py +100 -0
  181. tico-0.2.0/tico/quantization/algorithm/smoothquant/smooth_quant.py +611 -0
  182. tico-0.2.0/tico/quantization/algorithm/spinquant/__init__.py +1 -0
  183. tico-0.2.0/tico/quantization/algorithm/spinquant/fuse_norm_utils.py +263 -0
  184. tico-0.2.0/tico/quantization/algorithm/spinquant/hadamard_utils.py +601 -0
  185. tico-0.2.0/tico/quantization/algorithm/spinquant/quantizer.py +368 -0
  186. tico-0.2.0/tico/quantization/algorithm/spinquant/qwen3_vl_model_utils.py +407 -0
  187. tico-0.2.0/tico/quantization/algorithm/spinquant/qwen3_vl_quantizer.py +443 -0
  188. tico-0.2.0/tico/quantization/algorithm/spinquant/qwen3_vl_rotation_utils.py +1079 -0
  189. tico-0.2.0/tico/quantization/algorithm/spinquant/rotation_utils.py +518 -0
  190. tico-0.2.0/tico/quantization/algorithm/spinquant/spin_llama.py +360 -0
  191. tico-0.2.0/tico/quantization/algorithm/spinquant/spin_qwen3_vl.py +287 -0
  192. tico-0.2.0/tico/quantization/algorithm/universal_gptq/quantizer.py +1043 -0
  193. tico-0.2.0/tico/quantization/analysis/__init__.py +88 -0
  194. tico-0.2.0/tico/quantization/analysis/ablation.py +133 -0
  195. tico-0.2.0/tico/quantization/analysis/clipping.py +476 -0
  196. tico-0.2.0/tico/quantization/analysis/inputs.py +52 -0
  197. tico-0.2.0/tico/quantization/analysis/metrics.py +137 -0
  198. tico-0.2.0/tico/quantization/analysis/output_quantization.py +240 -0
  199. tico-0.2.0/tico/quantization/analysis/outputs.py +98 -0
  200. tico-0.2.0/tico/quantization/analysis/profile.py +56 -0
  201. tico-0.2.0/tico/quantization/analysis/report.py +84 -0
  202. tico-0.2.0/tico/quantization/analysis/selector.py +163 -0
  203. tico-0.2.0/tico/quantization/analysis/sensitivity.py +531 -0
  204. tico-0.2.0/tico/quantization/config/__init__.py +30 -0
  205. tico-0.2.0/tico/quantization/config/base.py +26 -0
  206. tico-0.2.0/tico/quantization/config/builders.py +511 -0
  207. tico-0.2.0/tico/quantization/config/cle.py +55 -0
  208. tico-0.2.0/tico/quantization/config/fpi_gptq.py +32 -0
  209. tico-0.2.0/tico/quantization/config/gemma4_assistant_builders.py +116 -0
  210. tico-0.2.0/tico/quantization/config/gemma4_attention.py +196 -0
  211. tico-0.2.0/tico/quantization/config/gemma4_builders.py +368 -0
  212. tico-0.2.0/tico/quantization/config/gemma4_gptq.py +183 -0
  213. tico-0.2.0/tico/quantization/config/gptq.py +160 -0
  214. tico-0.2.0/tico/quantization/config/llama_attention.py +209 -0
  215. tico-0.2.0/tico/quantization/config/ptq.py +341 -0
  216. tico-0.2.0/tico/quantization/config/qwen3_vl_attention.py +199 -0
  217. tico-0.2.0/tico/quantization/config/qwen3_vl_gptq.py +157 -0
  218. tico-0.2.0/tico/quantization/config/qwen3_vl_spinquant.py +302 -0
  219. tico-0.2.0/tico/quantization/config/smoothquant.py +41 -0
  220. tico-0.2.0/tico/quantization/config/specs.py +185 -0
  221. tico-0.2.0/tico/quantization/config/spinquant.py +102 -0
  222. tico-0.2.0/tico/quantization/config/utils.py +41 -0
  223. tico-0.2.0/tico/quantization/evaluation/__init__.py +1 -0
  224. tico-0.2.0/tico/quantization/evaluation/backend.py +20 -0
  225. tico-0.2.0/tico/quantization/evaluation/evaluate.py +214 -0
  226. tico-0.2.0/tico/quantization/evaluation/executor/__init__.py +1 -0
  227. tico-0.2.0/tico/quantization/evaluation/executor/backend_executor.py +54 -0
  228. tico-0.2.0/tico/quantization/evaluation/executor/circle_executor.py +74 -0
  229. tico-0.2.0/tico/quantization/evaluation/executor/triv24_executor.py +126 -0
  230. tico-0.2.0/tico/quantization/evaluation/hellaswag_eval_utils.py +144 -0
  231. tico-0.2.0/tico/quantization/evaluation/llava_bench_judge_eval_utils.py +1127 -0
  232. tico-0.2.0/tico/quantization/evaluation/lmms_eval_utils.py +1236 -0
  233. tico-0.2.0/tico/quantization/evaluation/lmms_gemma4.py +275 -0
  234. tico-0.2.0/tico/quantization/evaluation/lmms_tasks/videomme_mini/utils.py +172 -0
  235. tico-0.2.0/tico/quantization/evaluation/metric.py +146 -0
  236. tico-0.2.0/tico/quantization/evaluation/mmlu_eval_utils.py +122 -0
  237. tico-0.2.0/tico/quantization/evaluation/mmmu_eval_utils.py +530 -0
  238. tico-0.2.0/tico/quantization/evaluation/optional_deps.py +89 -0
  239. tico-0.2.0/tico/quantization/evaluation/script/llm_tasks_eval.py +147 -0
  240. tico-0.2.0/tico/quantization/evaluation/script/mini_vqa_eval.py +185 -0
  241. tico-0.2.0/tico/quantization/evaluation/utils.py +197 -0
  242. tico-0.2.0/tico/quantization/evaluation/vlm_eval_utils.py +1710 -0
  243. tico-0.2.0/tico/quantization/examples/__init__.py +1 -0
  244. tico-0.2.0/tico/quantization/examples/compare_side_by_side.py +222 -0
  245. tico-0.2.0/tico/quantization/examples/configs/__init__.py +1 -0
  246. tico-0.2.0/tico/quantization/examples/evaluate.py +107 -0
  247. tico-0.2.0/tico/quantization/examples/export.py +167 -0
  248. tico-0.2.0/tico/quantization/examples/inspector.py +292 -0
  249. tico-0.2.0/tico/quantization/examples/quantize.py +58 -0
  250. tico-0.2.0/tico/quantization/passes/__init__.py +1 -0
  251. tico-0.2.0/tico/quantization/passes/concat_qparam.py +84 -0
  252. tico-0.2.0/tico/quantization/passes/fold_quant_ops.py +290 -0
  253. tico-0.2.0/tico/quantization/passes/insert_quantize_on_dtype_mismatch.py +459 -0
  254. tico-0.2.0/tico/quantization/passes/legalize_quantized_clamp.py +464 -0
  255. tico-0.2.0/tico/quantization/passes/propagate_qparam_backward.py +95 -0
  256. tico-0.2.0/tico/quantization/passes/propagate_qparam_forward.py +207 -0
  257. tico-0.2.0/tico/quantization/passes/qparam_safe_const_prop.py +522 -0
  258. tico-0.2.0/tico/quantization/passes/quantize_bias.py +153 -0
  259. tico-0.2.0/tico/quantization/passes/remove_weight_dequant_op.py +290 -0
  260. tico-0.2.0/tico/quantization/public_interface.py +99 -0
  261. tico-0.2.0/tico/quantization/quant_stub.py +28 -0
  262. tico-0.2.0/tico/quantization/quantizer.py +71 -0
  263. tico-0.2.0/tico/quantization/quantizer_registry.py +99 -0
  264. tico-0.2.0/tico/quantization/recipes/__init__.py +17 -0
  265. tico-0.2.0/tico/quantization/recipes/adapters/__init__.py +122 -0
  266. tico-0.2.0/tico/quantization/recipes/adapters/base.py +111 -0
  267. tico-0.2.0/tico/quantization/recipes/adapters/gemma4.py +644 -0
  268. tico-0.2.0/tico/quantization/recipes/adapters/gemma4_assistant.py +596 -0
  269. tico-0.2.0/tico/quantization/recipes/adapters/llama.py +454 -0
  270. tico-0.2.0/tico/quantization/recipes/adapters/qwen3_vl.py +667 -0
  271. tico-0.2.0/tico/quantization/recipes/config.py +293 -0
  272. tico-0.2.0/tico/quantization/recipes/context.py +41 -0
  273. tico-0.2.0/tico/quantization/recipes/data/__init__.py +1 -0
  274. tico-0.2.0/tico/quantization/recipes/data/dataset_usage.py +1152 -0
  275. tico-0.2.0/tico/quantization/recipes/data/llm.py +90 -0
  276. tico-0.2.0/tico/quantization/recipes/data/vlm.py +229 -0
  277. tico-0.2.0/tico/quantization/recipes/debug/__init__.py +1 -0
  278. tico-0.2.0/tico/quantization/recipes/debug/static_gemma4_assistant_runtime.py +348 -0
  279. tico-0.2.0/tico/quantization/recipes/debug/static_gemma4_runtime.py +1968 -0
  280. tico-0.2.0/tico/quantization/recipes/debug/static_llama_runtime.py +1088 -0
  281. tico-0.2.0/tico/quantization/recipes/debug/static_qwen3_vl_runtime.py +1501 -0
  282. tico-0.2.0/tico/quantization/recipes/debug/tied_embedding.py +227 -0
  283. tico-0.2.0/tico/quantization/recipes/debug/trace.py +185 -0
  284. tico-0.2.0/tico/quantization/recipes/debug/wrapper_smoke/__init__.py +32 -0
  285. tico-0.2.0/tico/quantization/recipes/debug/wrapper_smoke/case.py +140 -0
  286. tico-0.2.0/tico/quantization/recipes/debug/wrapper_smoke/cases/__init__.py +1 -0
  287. tico-0.2.0/tico/quantization/recipes/debug/wrapper_smoke/cases/gemma4.py +2847 -0
  288. tico-0.2.0/tico/quantization/recipes/debug/wrapper_smoke/cases/gemma4_assistant.py +250 -0
  289. tico-0.2.0/tico/quantization/recipes/debug/wrapper_smoke/cases/llama.py +671 -0
  290. tico-0.2.0/tico/quantization/recipes/debug/wrapper_smoke/cases/nn.py +206 -0
  291. tico-0.2.0/tico/quantization/recipes/debug/wrapper_smoke/cases/qwen3_vl.py +1471 -0
  292. tico-0.2.0/tico/quantization/recipes/debug/wrapper_smoke/registry.py +80 -0
  293. tico-0.2.0/tico/quantization/recipes/debug/wrapper_smoke/result.py +96 -0
  294. tico-0.2.0/tico/quantization/recipes/debug/wrapper_smoke/runner.py +302 -0
  295. tico-0.2.0/tico/quantization/recipes/debug/wrapper_smoke/utils.py +155 -0
  296. tico-0.2.0/tico/quantization/recipes/evaluation/__init__.py +1 -0
  297. tico-0.2.0/tico/quantization/recipes/evaluation/hellaswag.py +46 -0
  298. tico-0.2.0/tico/quantization/recipes/evaluation/llava_bench_judge.py +192 -0
  299. tico-0.2.0/tico/quantization/recipes/evaluation/llm.py +84 -0
  300. tico-0.2.0/tico/quantization/recipes/evaluation/mmlu.py +45 -0
  301. tico-0.2.0/tico/quantization/recipes/evaluation/mmmu.py +51 -0
  302. tico-0.2.0/tico/quantization/recipes/evaluation/selection.py +161 -0
  303. tico-0.2.0/tico/quantization/recipes/evaluation/video_mme.py +95 -0
  304. tico-0.2.0/tico/quantization/recipes/evaluation/vlm.py +272 -0
  305. tico-0.2.0/tico/quantization/recipes/export/__init__.py +1 -0
  306. tico-0.2.0/tico/quantization/recipes/export/checkpoint.py +29 -0
  307. tico-0.2.0/tico/quantization/recipes/export/circle.py +68 -0
  308. tico-0.2.0/tico/quantization/recipes/export/gemma4.py +1217 -0
  309. tico-0.2.0/tico/quantization/recipes/export/gemma4_assistant.py +353 -0
  310. tico-0.2.0/tico/quantization/recipes/export/llama.py +375 -0
  311. tico-0.2.0/tico/quantization/recipes/export/qwen3_vl.py +481 -0
  312. tico-0.2.0/tico/quantization/recipes/extensions.py +119 -0
  313. tico-0.2.0/tico/quantization/recipes/override_policies.py +688 -0
  314. tico-0.2.0/tico/quantization/recipes/qparams.py +114 -0
  315. tico-0.2.0/tico/quantization/recipes/runner.py +410 -0
  316. tico-0.2.0/tico/quantization/recipes/stages/__init__.py +23 -0
  317. tico-0.2.0/tico/quantization/recipes/stages/base.py +30 -0
  318. tico-0.2.0/tico/quantization/recipes/stages/cle.py +57 -0
  319. tico-0.2.0/tico/quantization/recipes/stages/gptq.py +191 -0
  320. tico-0.2.0/tico/quantization/recipes/stages/ptq.py +257 -0
  321. tico-0.2.0/tico/quantization/recipes/stages/smoothquant.py +31 -0
  322. tico-0.2.0/tico/quantization/recipes/stages/spinquant.py +38 -0
  323. tico-0.2.0/tico/quantization/recipes/utils.py +199 -0
  324. tico-0.2.0/tico/quantization/wrapq/__init__.py +1 -0
  325. tico-0.2.0/tico/quantization/wrapq/control.py +132 -0
  326. tico-0.2.0/tico/quantization/wrapq/dtypes.py +70 -0
  327. tico-0.2.0/tico/quantization/wrapq/examples/__init__.py +1 -0
  328. tico-0.2.0/tico/quantization/wrapq/examples/compare_ppl.py +241 -0
  329. tico-0.2.0/tico/quantization/wrapq/examples/debug_quant_outputs.py +226 -0
  330. tico-0.2.0/tico/quantization/wrapq/examples/evaluate_fk_llama_model.py +685 -0
  331. tico-0.2.0/tico/quantization/wrapq/examples/gemma4/__init__.py +1 -0
  332. tico-0.2.0/tico/quantization/wrapq/examples/gemma4/quantize_for_causal_lm.py +163 -0
  333. tico-0.2.0/tico/quantization/wrapq/examples/gemma4/quantize_for_conditional_generation.py +215 -0
  334. tico-0.2.0/tico/quantization/wrapq/examples/gemma4/quantize_model.py +382 -0
  335. tico-0.2.0/tico/quantization/wrapq/examples/gemma4/quantize_multimodal_embedder.py +217 -0
  336. tico-0.2.0/tico/quantization/wrapq/examples/gemma4/quantize_text_scaled_word_embedding.py +149 -0
  337. tico-0.2.0/tico/quantization/wrapq/examples/gemma4/quantize_vision_model.py +197 -0
  338. tico-0.2.0/tico/quantization/wrapq/examples/gemma4/quantize_vision_patch_embedder.py +222 -0
  339. tico-0.2.0/tico/quantization/wrapq/examples/gemma4/quantize_vision_pooler.py +209 -0
  340. tico-0.2.0/tico/quantization/wrapq/examples/llama/__init__.py +1 -0
  341. tico-0.2.0/tico/quantization/wrapq/examples/llama/quantize_attention_decode.py +141 -0
  342. tico-0.2.0/tico/quantization/wrapq/examples/llama/quantize_attention_prefill.py +122 -0
  343. tico-0.2.0/tico/quantization/wrapq/examples/llama/quantize_decoder_layer_decode.py +189 -0
  344. tico-0.2.0/tico/quantization/wrapq/examples/llama/quantize_decoder_layer_prefill.py +166 -0
  345. tico-0.2.0/tico/quantization/wrapq/examples/llama/quantize_mlp.py +98 -0
  346. tico-0.2.0/tico/quantization/wrapq/examples/nn/__init__.py +1 -0
  347. tico-0.2.0/tico/quantization/wrapq/examples/nn/quantize_conv3d.py +132 -0
  348. tico-0.2.0/tico/quantization/wrapq/examples/nn/quantize_conv3d_special_case.py +137 -0
  349. tico-0.2.0/tico/quantization/wrapq/examples/nn/quantize_layernorm.py +108 -0
  350. tico-0.2.0/tico/quantization/wrapq/examples/nn/quantize_linear.py +109 -0
  351. tico-0.2.0/tico/quantization/wrapq/examples/nn/quantize_tied_embedding.py +330 -0
  352. tico-0.2.0/tico/quantization/wrapq/examples/quantize_full_qmodel_with_gptq.py +1455 -0
  353. tico-0.2.0/tico/quantization/wrapq/examples/quantize_qwen3_vl_with_gptq.py +1609 -0
  354. tico-0.2.0/tico/quantization/wrapq/examples/quantize_with_gptq.py +277 -0
  355. tico-0.2.0/tico/quantization/wrapq/examples/qwen/__init__.py +1 -0
  356. tico-0.2.0/tico/quantization/wrapq/examples/qwen/quantize_for_conditional_generation.py +360 -0
  357. tico-0.2.0/tico/quantization/wrapq/examples/qwen/quantize_model.py +363 -0
  358. tico-0.2.0/tico/quantization/wrapq/examples/qwen/quantize_text_attention.py +152 -0
  359. tico-0.2.0/tico/quantization/wrapq/examples/qwen/quantize_text_decoder_layer.py +157 -0
  360. tico-0.2.0/tico/quantization/wrapq/examples/qwen/quantize_text_mlp.py +114 -0
  361. tico-0.2.0/tico/quantization/wrapq/examples/qwen/quantize_text_model.py +149 -0
  362. tico-0.2.0/tico/quantization/wrapq/examples/qwen/quantize_vision_attention.py +163 -0
  363. tico-0.2.0/tico/quantization/wrapq/examples/qwen/quantize_vision_block.py +131 -0
  364. tico-0.2.0/tico/quantization/wrapq/examples/qwen/quantize_vision_mlp.py +98 -0
  365. tico-0.2.0/tico/quantization/wrapq/examples/qwen/quantize_vision_model.py +132 -0
  366. tico-0.2.0/tico/quantization/wrapq/examples/qwen/quantize_vision_patch_embed.py +104 -0
  367. tico-0.2.0/tico/quantization/wrapq/examples/qwen/quantize_vision_patch_merger.py +133 -0
  368. tico-0.2.0/tico/quantization/wrapq/examples/qwen/trace_qwen.py +635 -0
  369. tico-0.2.0/tico/quantization/wrapq/examples/static_llama_layer_runtime.py +1251 -0
  370. tico-0.2.0/tico/quantization/wrapq/mode.py +32 -0
  371. tico-0.2.0/tico/quantization/wrapq/observers/__init__.py +1 -0
  372. tico-0.2.0/tico/quantization/wrapq/observers/affine_base.py +194 -0
  373. tico-0.2.0/tico/quantization/wrapq/observers/base.py +113 -0
  374. tico-0.2.0/tico/quantization/wrapq/observers/ema.py +62 -0
  375. tico-0.2.0/tico/quantization/wrapq/observers/identity.py +74 -0
  376. tico-0.2.0/tico/quantization/wrapq/observers/minmax.py +39 -0
  377. tico-0.2.0/tico/quantization/wrapq/observers/mx.py +62 -0
  378. tico-0.2.0/tico/quantization/wrapq/observers/percentile.py +299 -0
  379. tico-0.2.0/tico/quantization/wrapq/qscheme.py +40 -0
  380. tico-0.2.0/tico/quantization/wrapq/quantizer.py +74 -0
  381. tico-0.2.0/tico/quantization/wrapq/utils/__init__.py +1 -0
  382. tico-0.2.0/tico/quantization/wrapq/utils/check_missing_qparam.py +161 -0
  383. tico-0.2.0/tico/quantization/wrapq/utils/introspection.py +940 -0
  384. tico-0.2.0/tico/quantization/wrapq/utils/linear_folding.py +163 -0
  385. tico-0.2.0/tico/quantization/wrapq/utils/metrics.py +456 -0
  386. tico-0.2.0/tico/quantization/wrapq/utils/reduce_utils.py +32 -0
  387. tico-0.2.0/tico/quantization/wrapq/utils/utils.py +87 -0
  388. tico-0.2.0/tico/quantization/wrapq/utils/version.py +17 -0
  389. tico-0.2.0/tico/quantization/wrapq/wrap_helper.py +230 -0
  390. tico-0.2.0/tico/quantization/wrapq/wrappers/__init__.py +1 -0
  391. tico-0.2.0/tico/quantization/wrapq/wrappers/fairseq/__init__.py +5 -0
  392. tico-0.2.0/tico/quantization/wrapq/wrappers/fairseq/decoder_export_single_step.py +234 -0
  393. tico-0.2.0/tico/quantization/wrapq/wrappers/fairseq/quant_decoder.py +427 -0
  394. tico-0.2.0/tico/quantization/wrapq/wrappers/fairseq/quant_decoder_layer.py +476 -0
  395. tico-0.2.0/tico/quantization/wrapq/wrappers/fairseq/quant_encoder.py +330 -0
  396. tico-0.2.0/tico/quantization/wrapq/wrappers/fairseq/quant_encoder_layer.py +154 -0
  397. tico-0.2.0/tico/quantization/wrapq/wrappers/fairseq/quant_mha.py +383 -0
  398. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/__init__.py +1 -0
  399. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/export_adapters.py +836 -0
  400. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/ple_embedding_host.py +367 -0
  401. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_clippable_linear.py +67 -0
  402. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_for_causal_lm.py +232 -0
  403. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_for_conditional_generation.py +256 -0
  404. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_model.py +569 -0
  405. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_multimodal_embedder.py +62 -0
  406. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_rmsnorm.py +81 -0
  407. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_text_attention.py +883 -0
  408. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_text_decoder_layer.py +389 -0
  409. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_text_mlp.py +70 -0
  410. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_text_model.py +880 -0
  411. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_text_scaled_word_embedding.py +99 -0
  412. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_vision_attention.py +553 -0
  413. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_vision_encoder.py +350 -0
  414. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_vision_encoder_layer.py +166 -0
  415. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_vision_mlp.py +66 -0
  416. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_vision_model.py +348 -0
  417. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_vision_patch_embedder.py +263 -0
  418. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/quant_vision_pooler.py +347 -0
  419. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/rope.py +55 -0
  420. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/static_vision_profile.py +574 -0
  421. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/utils.py +454 -0
  422. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4/vision_split_export.py +492 -0
  423. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4_assistant/__init__.py +0 -0
  424. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4_assistant/export_adapters.py +139 -0
  425. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4_assistant/quant_backbone.py +188 -0
  426. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4_assistant/quant_for_causal_lm.py +316 -0
  427. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4_assistant/quant_masked_embedder.py +115 -0
  428. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4_assistant/sparse_head.py +314 -0
  429. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4_assistant/static_inputs.py +450 -0
  430. tico-0.2.0/tico/quantization/wrapq/wrappers/gemma4_assistant/utils.py +232 -0
  431. tico-0.2.0/tico/quantization/wrapq/wrappers/llama/__init__.py +1 -0
  432. tico-0.2.0/tico/quantization/wrapq/wrappers/llama/export_adapters.py +526 -0
  433. tico-0.2.0/tico/quantization/wrapq/wrappers/llama/quant_attention.py +1141 -0
  434. tico-0.2.0/tico/quantization/wrapq/wrappers/llama/quant_decoder_layer.py +394 -0
  435. tico-0.2.0/tico/quantization/wrapq/wrappers/llama/quant_mlp.py +94 -0
  436. tico-0.2.0/tico/quantization/wrapq/wrappers/llama/quant_model.py +633 -0
  437. tico-0.2.0/tico/quantization/wrapq/wrappers/llama/quant_model_for_causal_lm.py +297 -0
  438. tico-0.2.0/tico/quantization/wrapq/wrappers/nn/__init__.py +1 -0
  439. tico-0.2.0/tico/quantization/wrapq/wrappers/nn/quant_conv2d.py +91 -0
  440. tico-0.2.0/tico/quantization/wrapq/wrappers/nn/quant_conv3d.py +143 -0
  441. tico-0.2.0/tico/quantization/wrapq/wrappers/nn/quant_conv3d_decomposed.py +492 -0
  442. tico-0.2.0/tico/quantization/wrapq/wrappers/nn/quant_conv_transpose2d.py +85 -0
  443. tico-0.2.0/tico/quantization/wrapq/wrappers/nn/quant_embedding.py +73 -0
  444. tico-0.2.0/tico/quantization/wrapq/wrappers/nn/quant_layernorm.py +191 -0
  445. tico-0.2.0/tico/quantization/wrapq/wrappers/nn/quant_linear.py +65 -0
  446. tico-0.2.0/tico/quantization/wrapq/wrappers/nn/quant_maxpool2d.py +56 -0
  447. tico-0.2.0/tico/quantization/wrapq/wrappers/nn/quant_prelu.py +87 -0
  448. tico-0.2.0/tico/quantization/wrapq/wrappers/nn/quant_silu.py +60 -0
  449. tico-0.2.0/tico/quantization/wrapq/wrappers/ops/__init__.py +1 -0
  450. tico-0.2.0/tico/quantization/wrapq/wrappers/ops/quant_concat.py +60 -0
  451. tico-0.2.0/tico/quantization/wrapq/wrappers/ops/quant_resize_bilinear.py +54 -0
  452. tico-0.2.0/tico/quantization/wrapq/wrappers/ops/quant_rmsnorm.py +71 -0
  453. tico-0.2.0/tico/quantization/wrapq/wrappers/ops/quant_same_padding_conv2d.py +24 -0
  454. tico-0.2.0/tico/quantization/wrapq/wrappers/ptq_wrapper.py +90 -0
  455. tico-0.2.0/tico/quantization/wrapq/wrappers/quant_elementwise.py +206 -0
  456. tico-0.2.0/tico/quantization/wrapq/wrappers/quant_module_base.py +264 -0
  457. tico-0.2.0/tico/quantization/wrapq/wrappers/quant_stub.py +52 -0
  458. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/export_adapters.py +655 -0
  459. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/quant_for_conditional_generation.py +238 -0
  460. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/quant_model.py +718 -0
  461. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/quant_text_attention.py +909 -0
  462. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/quant_text_decoder_layer.py +226 -0
  463. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/quant_text_mlp.py +109 -0
  464. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/quant_text_model.py +684 -0
  465. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/quant_vision_attention.py +238 -0
  466. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/quant_vision_block.py +158 -0
  467. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/quant_vision_mlp.py +93 -0
  468. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/quant_vision_model.py +512 -0
  469. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/quant_vision_patch_embed.py +167 -0
  470. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/quant_vision_patch_merger.py +119 -0
  471. tico-0.2.0/tico/quantization/wrapq/wrappers/qwen_vl/vision_profile.py +186 -0
  472. tico-0.2.0/tico/quantization/wrapq/wrappers/registry.py +231 -0
  473. tico-0.2.0/tico/serialize/__init__.py +1 -0
  474. tico-0.2.0/tico/serialize/circle_graph.py +339 -0
  475. tico-0.2.0/tico/serialize/circle_mapping.py +281 -0
  476. tico-0.2.0/tico/serialize/circle_serializer.py +519 -0
  477. tico-0.2.0/tico/serialize/operators/__init__.py +28 -0
  478. tico-0.2.0/tico/serialize/operators/adapters/__init__.py +1 -0
  479. tico-0.2.0/tico/serialize/operators/adapters/llama_rmsnorm.py +35 -0
  480. tico-0.2.0/tico/serialize/operators/adapters/onert/__init__.py +1 -0
  481. tico-0.2.0/tico/serialize/operators/adapters/onert/llama_attention.py +51 -0
  482. tico-0.2.0/tico/serialize/operators/hashable_opcode.py +43 -0
  483. tico-0.2.0/tico/serialize/operators/node_visitor.py +80 -0
  484. tico-0.2.0/tico/serialize/operators/op_abs.py +53 -0
  485. tico-0.2.0/tico/serialize/operators/op_add.py +69 -0
  486. tico-0.2.0/tico/serialize/operators/op_alias_copy.py +64 -0
  487. tico-0.2.0/tico/serialize/operators/op_any.py +143 -0
  488. tico-0.2.0/tico/serialize/operators/op_arange_start_step.py +61 -0
  489. tico-0.2.0/tico/serialize/operators/op_argmax.py +62 -0
  490. tico-0.2.0/tico/serialize/operators/op_attention.py +58 -0
  491. tico-0.2.0/tico/serialize/operators/op_avg_pool2d.py +199 -0
  492. tico-0.2.0/tico/serialize/operators/op_bmm.py +62 -0
  493. tico-0.2.0/tico/serialize/operators/op_cat.py +66 -0
  494. tico-0.2.0/tico/serialize/operators/op_circle_gather_nd.py +53 -0
  495. tico-0.2.0/tico/serialize/operators/op_circle_shape.py +64 -0
  496. tico-0.2.0/tico/serialize/operators/op_clamp.py +132 -0
  497. tico-0.2.0/tico/serialize/operators/op_clone.py +71 -0
  498. tico-0.2.0/tico/serialize/operators/op_constant_pad_nd.py +102 -0
  499. tico-0.2.0/tico/serialize/operators/op_conv2d.py +178 -0
  500. tico-0.2.0/tico/serialize/operators/op_cos.py +59 -0
  501. tico-0.2.0/tico/serialize/operators/op_cumsum.py +97 -0
  502. tico-0.2.0/tico/serialize/operators/op_depthwise_conv2d.py +194 -0
  503. tico-0.2.0/tico/serialize/operators/op_dequantize_per_channel.py +83 -0
  504. tico-0.2.0/tico/serialize/operators/op_dequantize_per_tensor.py +65 -0
  505. tico-0.2.0/tico/serialize/operators/op_div.py +62 -0
  506. tico-0.2.0/tico/serialize/operators/op_elu.py +59 -0
  507. tico-0.2.0/tico/serialize/operators/op_embedding.py +60 -0
  508. tico-0.2.0/tico/serialize/operators/op_eq.py +64 -0
  509. tico-0.2.0/tico/serialize/operators/op_exp.py +60 -0
  510. tico-0.2.0/tico/serialize/operators/op_expand.py +91 -0
  511. tico-0.2.0/tico/serialize/operators/op_full.py +48 -0
  512. tico-0.2.0/tico/serialize/operators/op_full_like.py +53 -0
  513. tico-0.2.0/tico/serialize/operators/op_ge.py +54 -0
  514. tico-0.2.0/tico/serialize/operators/op_gelu.py +59 -0
  515. tico-0.2.0/tico/serialize/operators/op_gt.py +54 -0
  516. tico-0.2.0/tico/serialize/operators/op_index.py +82 -0
  517. tico-0.2.0/tico/serialize/operators/op_index_select.py +71 -0
  518. tico-0.2.0/tico/serialize/operators/op_instance_norm.py +85 -0
  519. tico-0.2.0/tico/serialize/operators/op_le.py +54 -0
  520. tico-0.2.0/tico/serialize/operators/op_leaky_relu.py +60 -0
  521. tico-0.2.0/tico/serialize/operators/op_linear.py +70 -0
  522. tico-0.2.0/tico/serialize/operators/op_log.py +53 -0
  523. tico-0.2.0/tico/serialize/operators/op_log1p.py +87 -0
  524. tico-0.2.0/tico/serialize/operators/op_logical_and.py +63 -0
  525. tico-0.2.0/tico/serialize/operators/op_logical_not.py +62 -0
  526. tico-0.2.0/tico/serialize/operators/op_lt.py +61 -0
  527. tico-0.2.0/tico/serialize/operators/op_max_dim.py +70 -0
  528. tico-0.2.0/tico/serialize/operators/op_max_pool2d_with_indices.py +165 -0
  529. tico-0.2.0/tico/serialize/operators/op_maximum.py +53 -0
  530. tico-0.2.0/tico/serialize/operators/op_mean.py +66 -0
  531. tico-0.2.0/tico/serialize/operators/op_minimum.py +53 -0
  532. tico-0.2.0/tico/serialize/operators/op_mm.py +61 -0
  533. tico-0.2.0/tico/serialize/operators/op_mul.py +93 -0
  534. tico-0.2.0/tico/serialize/operators/op_ne.py +54 -0
  535. tico-0.2.0/tico/serialize/operators/op_neg.py +59 -0
  536. tico-0.2.0/tico/serialize/operators/op_permute.py +65 -0
  537. tico-0.2.0/tico/serialize/operators/op_pow.py +143 -0
  538. tico-0.2.0/tico/serialize/operators/op_prelu.py +59 -0
  539. tico-0.2.0/tico/serialize/operators/op_quantize_per_tensor.py +139 -0
  540. tico-0.2.0/tico/serialize/operators/op_reciprocal.py +64 -0
  541. tico-0.2.0/tico/serialize/operators/op_relu.py +53 -0
  542. tico-0.2.0/tico/serialize/operators/op_relu6.py +52 -0
  543. tico-0.2.0/tico/serialize/operators/op_repeat.py +109 -0
  544. tico-0.2.0/tico/serialize/operators/op_reshape.py +73 -0
  545. tico-0.2.0/tico/serialize/operators/op_resize_bilinear.py +70 -0
  546. tico-0.2.0/tico/serialize/operators/op_resize_nearest_neighbor.py +70 -0
  547. tico-0.2.0/tico/serialize/operators/op_rmsnorm.py +91 -0
  548. tico-0.2.0/tico/serialize/operators/op_round.py +53 -0
  549. tico-0.2.0/tico/serialize/operators/op_rsqrt.py +53 -0
  550. tico-0.2.0/tico/serialize/operators/op_scalar_tensor.py +51 -0
  551. tico-0.2.0/tico/serialize/operators/op_select_copy.py +65 -0
  552. tico-0.2.0/tico/serialize/operators/op_sigmoid.py +56 -0
  553. tico-0.2.0/tico/serialize/operators/op_sin.py +53 -0
  554. tico-0.2.0/tico/serialize/operators/op_slice.py +155 -0
  555. tico-0.2.0/tico/serialize/operators/op_softmax.py +93 -0
  556. tico-0.2.0/tico/serialize/operators/op_split_with_sizes.py +107 -0
  557. tico-0.2.0/tico/serialize/operators/op_sqrt.py +55 -0
  558. tico-0.2.0/tico/serialize/operators/op_squeeze.py +73 -0
  559. tico-0.2.0/tico/serialize/operators/op_sub.py +71 -0
  560. tico-0.2.0/tico/serialize/operators/op_sum.py +63 -0
  561. tico-0.2.0/tico/serialize/operators/op_tanh.py +54 -0
  562. tico-0.2.0/tico/serialize/operators/op_to_copy.py +105 -0
  563. tico-0.2.0/tico/serialize/operators/op_transpose_conv.py +168 -0
  564. tico-0.2.0/tico/serialize/operators/op_unsqueeze.py +66 -0
  565. tico-0.2.0/tico/serialize/operators/op_view.py +75 -0
  566. tico-0.2.0/tico/serialize/operators/op_where.py +82 -0
  567. tico-0.2.0/tico/serialize/operators/utils.py +94 -0
  568. tico-0.2.0/tico/serialize/pack.py +49 -0
  569. tico-0.2.0/tico/serialize/quant_param.py +42 -0
  570. tico-0.2.0/tico/utils/__init__.py +1 -0
  571. tico-0.2.0/tico/utils/compat/__init__.py +1 -0
  572. tico-0.2.0/tico/utils/compat/torch.py +52 -0
  573. tico-0.2.0/tico/utils/compat/torch_version_policy.py +371 -0
  574. tico-0.2.0/tico/utils/compat/transformers.py +55 -0
  575. tico-0.2.0/tico/utils/convert.py +405 -0
  576. tico-0.2.0/tico/utils/define.py +35 -0
  577. tico-0.2.0/tico/utils/diff_graph.py +181 -0
  578. tico-0.2.0/tico/utils/dtype.py +42 -0
  579. tico-0.2.0/tico/utils/errors.py +35 -0
  580. tico-0.2.0/tico/utils/graph.py +329 -0
  581. tico-0.2.0/tico/utils/installed_packages.py +35 -0
  582. tico-0.2.0/tico/utils/logging.py +45 -0
  583. tico-0.2.0/tico/utils/model.py +38 -0
  584. tico-0.2.0/tico/utils/mx/__init__.py +1 -0
  585. tico-0.2.0/tico/utils/mx/dtypes.py +93 -0
  586. tico-0.2.0/tico/utils/mx/elemwise_ops.py +267 -0
  587. tico-0.2.0/tico/utils/mx/formats.py +125 -0
  588. tico-0.2.0/tico/utils/mx/mx_ops.py +255 -0
  589. tico-0.2.0/tico/utils/padding.py +95 -0
  590. tico-0.2.0/tico/utils/passes.py +76 -0
  591. tico-0.2.0/tico/utils/pytree_utils.py +501 -0
  592. tico-0.2.0/tico/utils/record_input.py +102 -0
  593. tico-0.2.0/tico/utils/register_custom_op.py +1233 -0
  594. tico-0.2.0/tico/utils/serialize.py +55 -0
  595. tico-0.2.0/tico/utils/signature.py +247 -0
  596. tico-0.2.0/tico/utils/trace_decorators.py +101 -0
  597. tico-0.2.0/tico/utils/utils.py +419 -0
  598. tico-0.2.0/tico/utils/validate_args_kwargs.py +1321 -0
  599. tico-0.2.0/tico/utils/version.py +16 -0
  600. tico-0.2.0/tico.egg-info/PKG-INFO +422 -0
  601. tico-0.2.0/tico.egg-info/SOURCES.txt +603 -0
  602. tico-0.2.0/tico.egg-info/dependency_links.txt +1 -0
  603. tico-0.2.0/tico.egg-info/entry_points.txt +3 -0
  604. tico-0.2.0/tico.egg-info/requires.txt +6 -0
  605. tico-0.2.0/tico.egg-info/top_level.txt +1 -0
tico-0.2.0/LICENSE ADDED
@@ -0,0 +1,241 @@
1
+ This file provides full text of licenses used in this project
2
+
3
+ - Apache License 2.0
4
+ - BSD 3-Clause
5
+
6
+ ...............................................................................
7
+
8
+ Apache License
9
+ Version 2.0, January 2004
10
+ http://www.apache.org/licenses/
11
+
12
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
13
+
14
+ 1. Definitions.
15
+
16
+ "License" shall mean the terms and conditions for use, reproduction,
17
+ and distribution as defined by Sections 1 through 9 of this document.
18
+
19
+ "Licensor" shall mean the copyright owner or entity authorized by
20
+ the copyright owner that is granting the License.
21
+
22
+ "Legal Entity" shall mean the union of the acting entity and all
23
+ other entities that control, are controlled by, or are under common
24
+ control with that entity. For the purposes of this definition,
25
+ "control" means (i) the power, direct or indirect, to cause the
26
+ direction or management of such entity, whether by contract or
27
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
28
+ outstanding shares, or (iii) beneficial ownership of such entity.
29
+
30
+ "You" (or "Your") shall mean an individual or Legal Entity
31
+ exercising permissions granted by this License.
32
+
33
+ "Source" form shall mean the preferred form for making modifications,
34
+ including but not limited to software source code, documentation
35
+ source, and configuration files.
36
+
37
+ "Object" form shall mean any form resulting from mechanical
38
+ transformation or translation of a Source form, including but
39
+ not limited to compiled object code, generated documentation,
40
+ and conversions to other media types.
41
+
42
+ "Work" shall mean the work of authorship, whether in Source or
43
+ Object form, made available under the License, as indicated by a
44
+ copyright notice that is included in or attached to the work
45
+ (an example is provided in the Appendix below).
46
+
47
+ "Derivative Works" shall mean any work, whether in Source or Object
48
+ form, that is based on (or derived from) the Work and for which the
49
+ editorial revisions, annotations, elaborations, or other modifications
50
+ represent, as a whole, an original work of authorship. For the purposes
51
+ of this License, Derivative Works shall not include works that remain
52
+ separable from, or merely link (or bind by name) to the interfaces of,
53
+ the Work and Derivative Works thereof.
54
+
55
+ "Contribution" shall mean any work of authorship, including
56
+ the original version of the Work and any modifications or additions
57
+ to that Work or Derivative Works thereof, that is intentionally
58
+ submitted to Licensor for inclusion in the Work by the copyright owner
59
+ or by an individual or Legal Entity authorized to submit on behalf of
60
+ the copyright owner. For the purposes of this definition, "submitted"
61
+ means any form of electronic, verbal, or written communication sent
62
+ to the Licensor or its representatives, including but not limited to
63
+ communication on electronic mailing lists, source code control systems,
64
+ and issue tracking systems that are managed by, or on behalf of, the
65
+ Licensor for the purpose of discussing and improving the Work, but
66
+ excluding communication that is conspicuously marked or otherwise
67
+ designated in writing by the copyright owner as "Not a Contribution."
68
+
69
+ "Contributor" shall mean Licensor and any individual or Legal Entity
70
+ on behalf of whom a Contribution has been received by Licensor and
71
+ subsequently incorporated within the Work.
72
+
73
+ 2. Grant of Copyright License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ copyright license to reproduce, prepare Derivative Works of,
77
+ publicly display, publicly perform, sublicense, and distribute the
78
+ Work and such Derivative Works in Source or Object form.
79
+
80
+ 3. Grant of Patent License. Subject to the terms and conditions of
81
+ this License, each Contributor hereby grants to You a perpetual,
82
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
83
+ (except as stated in this section) patent license to make, have made,
84
+ use, offer to sell, sell, import, and otherwise transfer the Work,
85
+ where such license applies only to those patent claims licensable
86
+ by such Contributor that are necessarily infringed by their
87
+ Contribution(s) alone or by combination of their Contribution(s)
88
+ with the Work to which such Contribution(s) was submitted. If You
89
+ institute patent litigation against any entity (including a
90
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
91
+ or a Contribution incorporated within the Work constitutes direct
92
+ or contributory patent infringement, then any patent licenses
93
+ granted to You under this License for that Work shall terminate
94
+ as of the date such litigation is filed.
95
+
96
+ 4. Redistribution. You may reproduce and distribute copies of the
97
+ Work or Derivative Works thereof in any medium, with or without
98
+ modifications, and in Source or Object form, provided that You
99
+ meet the following conditions:
100
+
101
+ (a) You must give any other recipients of the Work or
102
+ Derivative Works a copy of this License; and
103
+
104
+ (b) You must cause any modified files to carry prominent notices
105
+ stating that You changed the files; and
106
+
107
+ (c) You must retain, in the Source form of any Derivative Works
108
+ that You distribute, all copyright, patent, trademark, and
109
+ attribution notices from the Source form of the Work,
110
+ excluding those notices that do not pertain to any part of
111
+ the Derivative Works; and
112
+
113
+ (d) If the Work includes a "NOTICE" text file as part of its
114
+ distribution, then any Derivative Works that You distribute must
115
+ include a readable copy of the attribution notices contained
116
+ within such NOTICE file, excluding those notices that do not
117
+ pertain to any part of the Derivative Works, in at least one
118
+ of the following places: within a NOTICE text file distributed
119
+ as part of the Derivative Works; within the Source form or
120
+ documentation, if provided along with the Derivative Works; or,
121
+ within a display generated by the Derivative Works, if and
122
+ wherever such third-party notices normally appear. The contents
123
+ of the NOTICE file are for informational purposes only and
124
+ do not modify the License. You may add Your own attribution
125
+ notices within Derivative Works that You distribute, alongside
126
+ or as an addendum to the NOTICE text from the Work, provided
127
+ that such additional attribution notices cannot be construed
128
+ as modifying the License.
129
+
130
+ You may add Your own copyright statement to Your modifications and
131
+ may provide additional or different license terms and conditions
132
+ for use, reproduction, or distribution of Your modifications, or
133
+ for any such Derivative Works as a whole, provided Your use,
134
+ reproduction, and distribution of the Work otherwise complies with
135
+ the conditions stated in this License.
136
+
137
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
138
+ any Contribution intentionally submitted for inclusion in the Work
139
+ by You to the Licensor shall be under the terms and conditions of
140
+ this License, without any additional terms or conditions.
141
+ Notwithstanding the above, nothing herein shall supersede or modify
142
+ the terms of any separate license agreement you may have executed
143
+ with Licensor regarding such Contributions.
144
+
145
+ 6. Trademarks. This License does not grant permission to use the trade
146
+ names, trademarks, service marks, or product names of the Licensor,
147
+ except as required for reasonable and customary use in describing the
148
+ origin of the Work and reproducing the content of the NOTICE file.
149
+
150
+ 7. Disclaimer of Warranty. Unless required by applicable law or
151
+ agreed to in writing, Licensor provides the Work (and each
152
+ Contributor provides its Contributions) on an "AS IS" BASIS,
153
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
154
+ implied, including, without limitation, any warranties or conditions
155
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
156
+ PARTICULAR PURPOSE. You are solely responsible for determining the
157
+ appropriateness of using or redistributing the Work and assume any
158
+ risks associated with Your exercise of permissions under this License.
159
+
160
+ 8. Limitation of Liability. In no event and under no legal theory,
161
+ whether in tort (including negligence), contract, or otherwise,
162
+ unless required by applicable law (such as deliberate and grossly
163
+ negligent acts) or agreed to in writing, shall any Contributor be
164
+ liable to You for damages, including any direct, indirect, special,
165
+ incidental, or consequential damages of any character arising as a
166
+ result of this License or out of the use or inability to use the
167
+ Work (including but not limited to damages for loss of goodwill,
168
+ work stoppage, computer failure or malfunction, or any and all
169
+ other commercial damages or losses), even if such Contributor
170
+ has been advised of the possibility of such damages.
171
+
172
+ 9. Accepting Warranty or Additional Liability. While redistributing
173
+ the Work or Derivative Works thereof, You may choose to offer,
174
+ and charge a fee for, acceptance of support, warranty, indemnity,
175
+ or other liability obligations and/or rights consistent with this
176
+ License. However, in accepting such obligations, You may act only
177
+ on Your own behalf and on Your sole responsibility, not on behalf
178
+ of any other Contributor, and only if You agree to indemnify,
179
+ defend, and hold each Contributor harmless for any liability
180
+ incurred by, or claims asserted against, such Contributor by reason
181
+ of your accepting any such warranty or additional liability.
182
+
183
+ END OF TERMS AND CONDITIONS
184
+
185
+ APPENDIX: How to apply the Apache License to your work.
186
+
187
+ To apply the Apache License to your work, attach the following
188
+ boilerplate notice, with the fields enclosed by brackets "[]"
189
+ replaced with your own identifying information. (Don't include
190
+ the brackets!) The text should be enclosed in the appropriate
191
+ comment syntax for the file format. We also recommend that a
192
+ file or class name and description of purpose be included on the
193
+ same "printed page" as the copyright notice for easier
194
+ identification within third-party archives.
195
+
196
+
197
+ Copyright [yyyy] [name of copyright owner]
198
+
199
+ Licensed under the Apache License, Version 2.0 (the "License");
200
+ you may not use this file except in compliance with the License.
201
+ You may obtain a copy of the License at
202
+
203
+ http://www.apache.org/licenses/LICENSE-2.0
204
+
205
+ Unless required by applicable law or agreed to in writing, software
206
+ distributed under the License is distributed on an "AS IS" BASIS,
207
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
208
+ See the License for the specific language governing permissions and
209
+ limitations under the License.
210
+
211
+ ...............................................................................
212
+
213
+ The BSD 3-Clause License
214
+
215
+ Redistribution and use in source and binary forms, with or without
216
+ modification, are permitted provided that the following conditions are
217
+ met:
218
+
219
+ * Redistributions of source code must retain the above copyright
220
+ notice, this list of conditions and the following disclaimer.
221
+ * Redistributions in binary form must reproduce the above
222
+ copyright notice, this list of conditions and the following disclaimer
223
+ in the documentation and/or other materials provided with the
224
+ distribution.
225
+ * Neither the name of Google Inc. nor the names of its
226
+ contributors may be used to endorse or promote products derived from
227
+ this software without specific prior written permission.
228
+
229
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
230
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
231
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
232
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
233
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
234
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
235
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
236
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
237
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
238
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
239
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
240
+
241
+ .............................................................................
tico-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,422 @@
1
+ Metadata-Version: 2.4
2
+ Name: tico
3
+ Version: 0.2.0
4
+ Summary: Convert Exported Torch Module To Circle
5
+ License: This file provides full text of licenses used in this project
6
+
7
+ - Apache License 2.0
8
+ - BSD 3-Clause
9
+
10
+ ...............................................................................
11
+
12
+ Apache License
13
+ Version 2.0, January 2004
14
+ http://www.apache.org/licenses/
15
+
16
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
17
+
18
+ 1. Definitions.
19
+
20
+ "License" shall mean the terms and conditions for use, reproduction,
21
+ and distribution as defined by Sections 1 through 9 of this document.
22
+
23
+ "Licensor" shall mean the copyright owner or entity authorized by
24
+ the copyright owner that is granting the License.
25
+
26
+ "Legal Entity" shall mean the union of the acting entity and all
27
+ other entities that control, are controlled by, or are under common
28
+ control with that entity. For the purposes of this definition,
29
+ "control" means (i) the power, direct or indirect, to cause the
30
+ direction or management of such entity, whether by contract or
31
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
32
+ outstanding shares, or (iii) beneficial ownership of such entity.
33
+
34
+ "You" (or "Your") shall mean an individual or Legal Entity
35
+ exercising permissions granted by this License.
36
+
37
+ "Source" form shall mean the preferred form for making modifications,
38
+ including but not limited to software source code, documentation
39
+ source, and configuration files.
40
+
41
+ "Object" form shall mean any form resulting from mechanical
42
+ transformation or translation of a Source form, including but
43
+ not limited to compiled object code, generated documentation,
44
+ and conversions to other media types.
45
+
46
+ "Work" shall mean the work of authorship, whether in Source or
47
+ Object form, made available under the License, as indicated by a
48
+ copyright notice that is included in or attached to the work
49
+ (an example is provided in the Appendix below).
50
+
51
+ "Derivative Works" shall mean any work, whether in Source or Object
52
+ form, that is based on (or derived from) the Work and for which the
53
+ editorial revisions, annotations, elaborations, or other modifications
54
+ represent, as a whole, an original work of authorship. For the purposes
55
+ of this License, Derivative Works shall not include works that remain
56
+ separable from, or merely link (or bind by name) to the interfaces of,
57
+ the Work and Derivative Works thereof.
58
+
59
+ "Contribution" shall mean any work of authorship, including
60
+ the original version of the Work and any modifications or additions
61
+ to that Work or Derivative Works thereof, that is intentionally
62
+ submitted to Licensor for inclusion in the Work by the copyright owner
63
+ or by an individual or Legal Entity authorized to submit on behalf of
64
+ the copyright owner. For the purposes of this definition, "submitted"
65
+ means any form of electronic, verbal, or written communication sent
66
+ to the Licensor or its representatives, including but not limited to
67
+ communication on electronic mailing lists, source code control systems,
68
+ and issue tracking systems that are managed by, or on behalf of, the
69
+ Licensor for the purpose of discussing and improving the Work, but
70
+ excluding communication that is conspicuously marked or otherwise
71
+ designated in writing by the copyright owner as "Not a Contribution."
72
+
73
+ "Contributor" shall mean Licensor and any individual or Legal Entity
74
+ on behalf of whom a Contribution has been received by Licensor and
75
+ subsequently incorporated within the Work.
76
+
77
+ 2. Grant of Copyright License. Subject to the terms and conditions of
78
+ this License, each Contributor hereby grants to You a perpetual,
79
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
80
+ copyright license to reproduce, prepare Derivative Works of,
81
+ publicly display, publicly perform, sublicense, and distribute the
82
+ Work and such Derivative Works in Source or Object form.
83
+
84
+ 3. Grant of Patent License. Subject to the terms and conditions of
85
+ this License, each Contributor hereby grants to You a perpetual,
86
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
87
+ (except as stated in this section) patent license to make, have made,
88
+ use, offer to sell, sell, import, and otherwise transfer the Work,
89
+ where such license applies only to those patent claims licensable
90
+ by such Contributor that are necessarily infringed by their
91
+ Contribution(s) alone or by combination of their Contribution(s)
92
+ with the Work to which such Contribution(s) was submitted. If You
93
+ institute patent litigation against any entity (including a
94
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
95
+ or a Contribution incorporated within the Work constitutes direct
96
+ or contributory patent infringement, then any patent licenses
97
+ granted to You under this License for that Work shall terminate
98
+ as of the date such litigation is filed.
99
+
100
+ 4. Redistribution. You may reproduce and distribute copies of the
101
+ Work or Derivative Works thereof in any medium, with or without
102
+ modifications, and in Source or Object form, provided that You
103
+ meet the following conditions:
104
+
105
+ (a) You must give any other recipients of the Work or
106
+ Derivative Works a copy of this License; and
107
+
108
+ (b) You must cause any modified files to carry prominent notices
109
+ stating that You changed the files; and
110
+
111
+ (c) You must retain, in the Source form of any Derivative Works
112
+ that You distribute, all copyright, patent, trademark, and
113
+ attribution notices from the Source form of the Work,
114
+ excluding those notices that do not pertain to any part of
115
+ the Derivative Works; and
116
+
117
+ (d) If the Work includes a "NOTICE" text file as part of its
118
+ distribution, then any Derivative Works that You distribute must
119
+ include a readable copy of the attribution notices contained
120
+ within such NOTICE file, excluding those notices that do not
121
+ pertain to any part of the Derivative Works, in at least one
122
+ of the following places: within a NOTICE text file distributed
123
+ as part of the Derivative Works; within the Source form or
124
+ documentation, if provided along with the Derivative Works; or,
125
+ within a display generated by the Derivative Works, if and
126
+ wherever such third-party notices normally appear. The contents
127
+ of the NOTICE file are for informational purposes only and
128
+ do not modify the License. You may add Your own attribution
129
+ notices within Derivative Works that You distribute, alongside
130
+ or as an addendum to the NOTICE text from the Work, provided
131
+ that such additional attribution notices cannot be construed
132
+ as modifying the License.
133
+
134
+ You may add Your own copyright statement to Your modifications and
135
+ may provide additional or different license terms and conditions
136
+ for use, reproduction, or distribution of Your modifications, or
137
+ for any such Derivative Works as a whole, provided Your use,
138
+ reproduction, and distribution of the Work otherwise complies with
139
+ the conditions stated in this License.
140
+
141
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
142
+ any Contribution intentionally submitted for inclusion in the Work
143
+ by You to the Licensor shall be under the terms and conditions of
144
+ this License, without any additional terms or conditions.
145
+ Notwithstanding the above, nothing herein shall supersede or modify
146
+ the terms of any separate license agreement you may have executed
147
+ with Licensor regarding such Contributions.
148
+
149
+ 6. Trademarks. This License does not grant permission to use the trade
150
+ names, trademarks, service marks, or product names of the Licensor,
151
+ except as required for reasonable and customary use in describing the
152
+ origin of the Work and reproducing the content of the NOTICE file.
153
+
154
+ 7. Disclaimer of Warranty. Unless required by applicable law or
155
+ agreed to in writing, Licensor provides the Work (and each
156
+ Contributor provides its Contributions) on an "AS IS" BASIS,
157
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
158
+ implied, including, without limitation, any warranties or conditions
159
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
160
+ PARTICULAR PURPOSE. You are solely responsible for determining the
161
+ appropriateness of using or redistributing the Work and assume any
162
+ risks associated with Your exercise of permissions under this License.
163
+
164
+ 8. Limitation of Liability. In no event and under no legal theory,
165
+ whether in tort (including negligence), contract, or otherwise,
166
+ unless required by applicable law (such as deliberate and grossly
167
+ negligent acts) or agreed to in writing, shall any Contributor be
168
+ liable to You for damages, including any direct, indirect, special,
169
+ incidental, or consequential damages of any character arising as a
170
+ result of this License or out of the use or inability to use the
171
+ Work (including but not limited to damages for loss of goodwill,
172
+ work stoppage, computer failure or malfunction, or any and all
173
+ other commercial damages or losses), even if such Contributor
174
+ has been advised of the possibility of such damages.
175
+
176
+ 9. Accepting Warranty or Additional Liability. While redistributing
177
+ the Work or Derivative Works thereof, You may choose to offer,
178
+ and charge a fee for, acceptance of support, warranty, indemnity,
179
+ or other liability obligations and/or rights consistent with this
180
+ License. However, in accepting such obligations, You may act only
181
+ on Your own behalf and on Your sole responsibility, not on behalf
182
+ of any other Contributor, and only if You agree to indemnify,
183
+ defend, and hold each Contributor harmless for any liability
184
+ incurred by, or claims asserted against, such Contributor by reason
185
+ of your accepting any such warranty or additional liability.
186
+
187
+ END OF TERMS AND CONDITIONS
188
+
189
+ APPENDIX: How to apply the Apache License to your work.
190
+
191
+ To apply the Apache License to your work, attach the following
192
+ boilerplate notice, with the fields enclosed by brackets "[]"
193
+ replaced with your own identifying information. (Don't include
194
+ the brackets!) The text should be enclosed in the appropriate
195
+ comment syntax for the file format. We also recommend that a
196
+ file or class name and description of purpose be included on the
197
+ same "printed page" as the copyright notice for easier
198
+ identification within third-party archives.
199
+
200
+
201
+ Copyright [yyyy] [name of copyright owner]
202
+
203
+ Licensed under the Apache License, Version 2.0 (the "License");
204
+ you may not use this file except in compliance with the License.
205
+ You may obtain a copy of the License at
206
+
207
+ http://www.apache.org/licenses/LICENSE-2.0
208
+
209
+ Unless required by applicable law or agreed to in writing, software
210
+ distributed under the License is distributed on an "AS IS" BASIS,
211
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
212
+ See the License for the specific language governing permissions and
213
+ limitations under the License.
214
+
215
+ ...............................................................................
216
+
217
+ The BSD 3-Clause License
218
+
219
+ Redistribution and use in source and binary forms, with or without
220
+ modification, are permitted provided that the following conditions are
221
+ met:
222
+
223
+ * Redistributions of source code must retain the above copyright
224
+ notice, this list of conditions and the following disclaimer.
225
+ * Redistributions in binary form must reproduce the above
226
+ copyright notice, this list of conditions and the following disclaimer
227
+ in the documentation and/or other materials provided with the
228
+ distribution.
229
+ * Neither the name of Google Inc. nor the names of its
230
+ contributors may be used to endorse or promote products derived from
231
+ this software without specific prior written permission.
232
+
233
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
234
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
235
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
236
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
237
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
238
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
239
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
240
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
241
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
242
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
243
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
244
+
245
+ .............................................................................
246
+
247
+ Requires-Python: >=3.10.0
248
+ Description-Content-Type: text/markdown
249
+ License-File: LICENSE
250
+ Requires-Dist: circle-schema
251
+ Requires-Dist: packaging
252
+ Requires-Dist: cffi
253
+ Requires-Dist: torch
254
+ Requires-Dist: pyyaml
255
+ Requires-Dist: tqdm
256
+ Dynamic: license-file
257
+
258
+ <p align="center">
259
+ <picture>
260
+ <source media="(prefers-color-scheme: dark)" srcset="./assets/logo/banner/tico-banner-dark.png">
261
+ <img src="./assets/logo/banner/tico-banner-light.png" alt="TICO — Torch IR to Circle" width="640">
262
+ </picture>
263
+ </p>
264
+
265
+ _TICO_ (**T**orch **I**R to **C**ircle [ONE](https://github.com/Samsung/ONE)) is a Python
266
+ library that converts PyTorch modules into Circle models — a lightweight and efficient
267
+ representation in ONE designed for optimized on-device neural network inference.
268
+
269
+ ## Highlights
270
+
271
+ - **One-call conversion** — `tico.convert()` turns an `nn.Module` into a ready-to-deploy `.circle` binary.
272
+ - **`.pt2` support** — convert saved `torch.export` programs via the Python API or the `pt2-to-circle` command-line tool.
273
+ - **Run Circle models in Python** — execute converted models directly for quick parity checks against PyTorch.
274
+ - **Circle artifact tools** — inspect, verify, extract, optimize, and clean up exported `.circle` graphs with the `tico.circle` API or `tico-circle` CLI.
275
+ - **Quantization toolkit** — a unified `prepare`/`convert` API with GPTQ, PTQ (WrapQ), SmoothQuant, SpinQuant, and CLE, plus config-driven CLI recipes for LLMs and VLMs.
276
+
277
+ ## Installation
278
+
279
+ ### Prerequisites
280
+
281
+ - Python **3.10+**
282
+ - (Optional) [one-compiler](https://github.com/Samsung/ONE/releases) — only required to run
283
+ inference with converted Circle models. Conversion itself does not need it.
284
+
285
+ We highly recommend using a virtual environment (e.g., conda, venv).
286
+
287
+ ### From PyPI
288
+
289
+ ```bash
290
+ pip install tico
291
+ ```
292
+
293
+ ### From source
294
+
295
+ ```bash
296
+ git clone https://github.com/Samsung/TICO.git
297
+ cd TICO
298
+
299
+ ./ccex build # generates build/ and dist/
300
+ ./ccex install # installs the package
301
+ ```
302
+
303
+ **`./ccex install` options**
304
+
305
+ | Option | Description |
306
+ |---|---|
307
+ | `--dist` | Install from the built wheel (default is editable mode) |
308
+ | `--torch_ver <ver>` | Torch version to install: a configured family (`2.5` ~ `2.13`; `2.5` ~ `2.9` are legacy best-effort and `2.13` is a candidate), an exact version (e.g. `2.13.0+cu132`), `nightly` (repository-pinned), or `nightly-latest` (moving Torch/TorchVision pair). Default: `2.12` |
309
+ | `--cuda_ver <maj.min>` | Override the detected CUDA version (e.g. `12.1`) |
310
+ | `--cpu_only` | Force a CPU-only Torch installation |
311
+
312
+ `./ccex install` pins the newest qualified stable family for a reproducible source
313
+ setup. Older configured families remain explicitly installable, while `pyproject.toml`
314
+ keeps an unbounded `torch` dependency so `pip install` does not reject a user-managed
315
+ Torch version. See the [PyTorch version policy](./docs/torch_version_policy.md) for the
316
+ installer, support, and CI tiers.
317
+
318
+ ## Quick start
319
+
320
+ ```python
321
+ import tico
322
+ import torch
323
+
324
+ class AddModule(torch.nn.Module):
325
+ def forward(self, x, y):
326
+ return x + y
327
+
328
+ torch_module = AddModule()
329
+ example_inputs = (torch.ones(4), torch.ones(4))
330
+
331
+ circle_model = tico.convert(torch_module.eval(), example_inputs)
332
+ circle_model.save('add.circle')
333
+ ```
334
+
335
+ > [!NOTE]
336
+ > Call `eval()` on the module before conversion. _TICO_ internally uses
337
+ > [`torch.export`](https://pytorch.org/docs/stable/export.html#torch-export), so the module
338
+ > must be export-able.
339
+
340
+ Converting a saved `.pt2` file from the command line:
341
+
342
+ ```bash
343
+ pt2-to-circle -i add.pt2 -o add.circle
344
+ ```
345
+
346
+ See the [Getting Started guide](./docs/getting_started.md) for compile configurations,
347
+ `.pt2` conversion, and running Circle models directly in Python.
348
+
349
+ ## Circle artifact tools
350
+
351
+ `tico.circle` provides Python APIs and the `tico-circle` CLI for inspecting and
352
+ transforming exported `.circle` files.
353
+
354
+ ```bash
355
+ tico-circle inspect model.circle --tensors --operators
356
+ tico-circle verify model.circle
357
+ tico-circle extract model.circle --ops 20-64 -o region.circle
358
+ tico-circle optimize model.circle --preset o1 -o model.o1.circle
359
+ ```
360
+
361
+ `verify` performs a static internal-consistency check of the Circle artifact itself, including
362
+ indices, graph connections, buffers, signatures, and subgraph references. It does not
363
+ run inference or validate numerical accuracy or backend compatibility.
364
+
365
+ See the [Circle artifact tools guide](./tico/circle/README.md) for the Python API,
366
+ exact verification rules, extraction semantics, semantic optimization and cleanup
367
+ passes, O1 scheduling, multi-subgraph and signature behavior, and stream pipelines.
368
+
369
+ ## Quantization
370
+
371
+ The [`tico.quantization`](./tico/quantization/README.md) module provides a unified,
372
+ modular interface for quantizing neural networks — including large language models —
373
+ through a simple two-step **prepare** → **convert** workflow:
374
+
375
+ ```python
376
+ from tico.quantization import prepare, convert
377
+ from tico.quantization.config.gptq import GPTQConfig
378
+
379
+ prepared_model = prepare(model.eval(), GPTQConfig())
380
+
381
+ for d in dataset: # calibration
382
+ prepared_model(d)
383
+
384
+ quantized_model = convert(prepared_model, GPTQConfig())
385
+ ```
386
+
387
+ - [Quantization overview](./tico/quantization/README.md) — API, architecture, and how to add a new algorithm
388
+ - [Quantization algorithms](./tico/quantization/algorithm/README.md) — GPTQ, SmoothQuant, SpinQuant, CLE, …
389
+ - [Config-driven CLI examples](./tico/quantization/examples/README.md) — quantize, evaluate, and inspect LLM/VLM recipes from the command line
390
+
391
+ ## Documentation
392
+
393
+ ### For users
394
+
395
+ | Document | Description |
396
+ |---|---|
397
+ | [Getting Started](./docs/getting_started.md) | Converting modules and `.pt2` files, compile configuration, running Circle models directly in Python |
398
+ | [Circle artifact tools](./tico/circle/README.md) | Inspecting, verifying, extracting, optimizing, and cleaning up exported Circle models |
399
+ | [Quantization](./tico/quantization/README.md) | The `prepare`/`convert` quantization API and toolkit |
400
+ | [Quantization examples](./tico/quantization/examples/README.md) | Command-line quantization, evaluation, and debugging workflows |
401
+
402
+ ### For developers
403
+
404
+ | Document | Description |
405
+ |---|---|
406
+ | [Development guide](./docs/development.md) | Environment setup, testing, and code formatting with `./ccex` |
407
+ | [System design](./docs/design.md) | Architecture, pass pipeline, invariants, and behavior design |
408
+ | [Circle artifact tools](./tico/circle/README.md#writing-a-new-circle-pass) | Circle pass contracts, index rewriting, verification, and test expectations |
409
+ | [Requirements](./docs/requirements.md) | Functional and non-functional requirements |
410
+ | [System tests](./docs/system_test.md) | System-level test coverage |
411
+
412
+ ## Contributing
413
+
414
+ Contributions are welcome! For quantization algorithms, start with the
415
+ [quantization contribution guide](./tico/quantization/README.md#contributing-adding-a-new-algorithm)
416
+ and the [recipes developer guide](./tico/quantization/recipes/README.md).
417
+ Before submitting a PR, set up the development environment and run the tests and
418
+ formatter as described in the [development guide](./docs/development.md).
419
+
420
+ ## License
421
+
422
+ Licensed under the Apache License 2.0 — see [LICENSE](./LICENSE).