Skip to content

0.33.0

Latest

Choose a tag to compare

@davidkoski davidkoski released this 27 Oct 22:49
· 3 commits to main since this release
7ede4fd

MLX

API Change

Source Breaking

  • compile(inputs:outputs:shapeless:_:) does not return @Sendable closure

  • MLXCustomFunction closures are now @Sendable

Note: the compile() change should only be source breaking if it was being used in an incorrect way
(which wasn't clear in the past). In particular:

  • functions and closures that capture Module state should be using inputs: and are not Sendable
  • functions and closures that are not Sendable cannot be made Sendable through this function

If you encounter a build failure:

  • see if you should be using the inputs: variant
  • see if you need Sendable on the output
  • try to convert the function/closure to a pure function

Potentially Source Breaking

  • MLXArray is not final, see MaterializedArray below

  • Linear, QuantizedLinear, QuantizedEmbedding changed parameters from bare MLXArray to @ParameterInfo

  • Logging (MLXLog) no longer uses cLogSupport library -- much simpler now

    • should be transparent as the library was internal
    • see #494

Behavior Change

  • eval() no longer holds evalLock while waiting for the result
  • tripletLoss() now uses correct p-norm
  • .shardedToAll with index segments now builds correct predicate for QuantizedLinear
  • JACCL distributed backend enabled (#502).

New API

MLX

  • MaterializedArray (#418): an evaluated, immutable array that can be shared across concurrency domains.
    • It has its own +=, -=, *= and /= operators.
    • MLXArray.materialized() -> MaterializedArray is new.
    • mlx-swift-lm adoption will be in ml-explore/mlx-swift-lm#335 or a follow-on
  • materialize(_:): takes an MLXArray or [MLXArray] and returns MaterializedArrays
    • It traps if called inside a transform.
  • vmapSendable(_:inAxes:outAxes:) -- transforms @Sendable closures
    @sendable versions for the [MLXArray], 1-argument and 2-argument forms.
  • 3-parameter VJP: VJP { primals, cotangents, outputs in … }
  • Safetensors loading:
    • Concurrent multi-file loading (#462): loadArrays(urls:stream:) and loadArraysAndMetadata(urls:stream:)
    • Byte-progress reporting (#427):
      • a new LoadProgress struct with url, completedUnitCount, totalUnitCount and fractionCompleted
  • MLXFast.gatedDeltaUpdate - chunked gated delta network forward pass
  • Memory.bufferSize(_:) - returns the size in bytes of the buffers behind the arrays, counting distinct storage only once
  • matrixTransposed(_:stream:)
  • uniqued() -- returns fixed sized unique values

MLXNN

  • MaterializedModule<LayerType: Module>: an open class that is @unchecked Sendable
    • It wraps a module and seals it.
    • After wrapping, mutating APIs on the original module (update, apply, freeze, train, …) trap.
  • Module.logicalParameterCount (open var): counts parameters, accounting for quantized packing.

What's Changed

New Contributors

Full Changelog: 0.32.3...0.33.0