mlx-teacache
Copyright 2026 Denis Ineshin

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

------------------------------------------------------------------------------
Third-party attributions
------------------------------------------------------------------------------

This product includes software derived from ali-vilab/TeaCache
(https://github.com/ali-vilab/TeaCache), licensed under Apache License 2.0:
  Copyright 2024-2025 the TeaCache authors.

  The polynomial coefficients in src/mlx_teacache/coefficients.py for the
  FLUX architecture (flux1-dev, flux1-schnell) are vendored verbatim from
  ali-vilab/TeaCache/TeaCache4FLUX/teacache_flux.py.

------------------------------------------------------------------------------

This product includes software derived from filipstrand/mflux
(https://github.com/filipstrand/mflux), licensed under MIT License:

  MIT License

  Copyright (c) 2024-2026 Filip Strand

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.

  mlx-teacache/src/mlx_teacache/integrations/mflux/forward.py reimplements the
  transformer forward passes from mflux's Flux1.Transformer and
  Flux2Klein.Flux2Transformer for the purpose of inserting TeaCache gating
  between body and tail. The reimplementation closely follows mflux's
  internal structure as of 0.17.5.
