Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlx 0.11.1 #169804

Merged
merged 2 commits into from Apr 23, 2024
Merged

mlx 0.11.1 #169804

Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 18 additions & 10 deletions Formula/m/mlx.rb
@@ -1,8 +1,8 @@
class Mlx < Formula
desc "Array framework for Apple silicon"
homepage "https://github.com/ml-explore/mlx"
url "https://github.com/ml-explore/mlx/archive/refs/tags/v0.10.0.tar.gz"
sha256 "09e9859e364ee8d19bf656730b7d6a471c8da2d397325efd1c73b836819f6e56"
url "https://github.com/ml-explore/mlx/archive/refs/tags/v0.11.1.tar.gz"
sha256 "20ffd4fee274b084661708407d0680eb9d1e9f16bb856b71546fd0beccbd1fad"
license "MIT"
head "https://github.com/ml-explore/mlx.git", branch: "main"

Expand All @@ -12,34 +12,42 @@ class Mlx < Formula
end

depends_on "cmake" => :build
depends_on "nlohmann-json" => :build
depends_on xcode: ["14.3", :build]
depends_on arch: :arm64
depends_on :macos
depends_on "[email protected]"

# Update to GIT_TAG at https://github.com/ml-explore/mlx/blob/v#{version}/mlx/io/CMakeLists.txt#L21
resource "gguflib" do
url "https://github.com/antirez/gguf-tools/archive/af7d88d808a7608a33723fba067036202910acb3.tar.gz"
sha256 "1ee2dde74a3f9506af9ad61d7638a5e87b5e891b5e36a5dd3d5f412a8ce8dd03"
end

def python3
"python3.12"
end

def install
args = %w[
ENV.append_to_cflags "-I#{Formula["nlohmann-json"].opt_include}/nlohmann"
(buildpath/"gguflib").install resource("gguflib")
args = %W[
-DBUILD_SHARED_LIBS=ON
-DFETCHCONTENT_SOURCE_DIR_GGUFLIB=#{buildpath}/gguflib
-DMLX_BUILD_BENCHMARKS=OFF
-DMLX_BUILD_EXAMPLES=OFF
-DMLX_BUILD_METAL=OFF
-DMLX_BUILD_PYTHON_BINDINGS=OFF
-DMLX_BUILD_TESTS=OFF
]
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args

system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"

env = { PYPI_RELEASE: version.to_s }
env["DEV_RELEASE"] = "1" if build.head?
env["MACOSX_DEPLOYMENT_TARGET"] = "#{MacOS.version.major}.#{MacOS.version.minor.to_i}" if OS.mac?
with_env(env) do
system python3, "-m", "pip", "install", *std_pip_args(build_isolation: true), "."
end
ENV[build.head? ? "DEV_RELEASE" : "PYPI_RELEASE"] = "1"
ENV["MACOSX_DEPLOYMENT_TARGET"] = "#{MacOS.version.major}.#{MacOS.version.minor.to_i}" if OS.mac?
system python3, "-m", "pip", "install", *std_pip_args(build_isolation: true), "."
end

test do
Expand Down