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

pytorch 2.5.0 torchvision 0.20.0 #194877

Merged
merged 6 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions Formula/o/openai-whisper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,33 @@ class OpenaiWhisper < Formula
url "https://files.pythonhosted.org/packages/f5/77/952ca71515f81919bd8a6a4a3f89a27b09e73880cebf90957eda8f2f8545/openai-whisper-20240930.tar.gz"
sha256 "b7178e9c1615576807a300024f4daa6353f7e1a815dac5e38c33f1ef055dd2d2"
license "MIT"
revision 1
head "https://github.com/openai/whisper.git", branch: "main"

bottle do
sha256 cellar: :any, arm64_sequoia: "333a5b728a7ec6580cc6971132da2ddfa4d6b2bc051660a0f9f705f636dd2bdf"
sha256 cellar: :any, arm64_sonoma: "13460c68971d6e2cae7907162fa9b0d20169f00175a6a221e729c3503cd6edce"
sha256 cellar: :any, arm64_ventura: "eaa165df04715ff60c266def5824423c35f23eb8d9a3bb1bf729fab41f503e62"
sha256 cellar: :any, sonoma: "50d19c37a08c45f69d4c282a0917038795446cdb05c92a508fb2e10edf5e6337"
sha256 cellar: :any, ventura: "75bfce6861bf4690f3cd19c43527d2ed01ba7d0691d42b0ae74342f94c03f3d9"
sha256 cellar: :any_skip_relocation, x86_64_linux: "d4b951c98a9be002e8744fa16db7d3d2e04bed5f143492ab23b1dbcbcd9107ca"
sha256 cellar: :any, arm64_sequoia: "fb20c184addee014fbd43a8035592e76c148b5ea8ce30e22fd5b1f17ca38b7aa"
sha256 cellar: :any, arm64_sonoma: "2ff5f9e031d71cdc3b66795bfadb17c67f9ad75466e695ad601dde1a60dce069"
sha256 cellar: :any, arm64_ventura: "175aba1ee80e67f54dae13ef88f265a53cce12e0acf3c43353a780cf11979573"
sha256 cellar: :any, sonoma: "60a4054c514839aade340a6f9e394c57f1f6d43e8f85bad84aa775c2aa5d49a3"
sha256 cellar: :any, ventura: "3b78fc5f446614ae7367a8c8204da6f3af00501437381e40306c904ad1dcad88"
sha256 cellar: :any_skip_relocation, x86_64_linux: "d1b019e05f4ec4d9a1cab322adc279ec2d89d07b32e0fa48b906902a3eaeb2c6"
end

depends_on "rust" => :build # for tiktoken
depends_on "certifi"
depends_on "ffmpeg"
depends_on "llvm@16" # LLVM 17 PR: https://github.com/numba/llvmlite/pull/1042
depends_on "numpy"
depends_on "python@3.12"
depends_on "python@3.13"
depends_on "pytorch"

on_linux do
depends_on "pkg-config" => :build
end

resource "charset-normalizer" do
url "https://files.pythonhosted.org/packages/63/09/c1bc53dab74b1816a00d8d030de5bf98f724c52c1635e07681d312f20be8/charset-normalizer-3.3.2.tar.gz"
sha256 "f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"
url "https://files.pythonhosted.org/packages/f2/4f/e1808dc01273379acc506d18f1504eb2d299bd4131743b9fc54d7be4df1e/charset_normalizer-3.4.0.tar.gz"
sha256 "223217c3d4f82c3ac5e29032b3f1c2eb0fb591b72161f86d93f5719079dae93e"
end

resource "idna" do
Expand All @@ -52,10 +53,10 @@ class OpenaiWhisper < Formula
end

resource "numba" do
# Fetch from Git hash for numpy 2.1 compatibility.
# Fetch from Git hash for numpy 2.1 and python 3.13 compatibility.
# Use git checkout to avoid .gitattributes causing checksum changes and unknown version info
url "https://github.com/numba/numba.git",
revision: "a344e8f55440c91d40c5221e93a38ce0c149b803"
revision: "391511bcb0b97af8d311cd276a46030774bc30b7"
end

resource "regex" do
Expand All @@ -69,8 +70,8 @@ class OpenaiWhisper < Formula
end

resource "tiktoken" do
url "https://files.pythonhosted.org/packages/c4/4a/abaec53e93e3ef37224a4dd9e2fc6bb871e7a538c2b6b9d2a6397271daf4/tiktoken-0.7.0.tar.gz"
sha256 "1077266e949c24e0291f6c350433c6f0971365ece2b173a23bc3b9f9defef6b6"
url "https://files.pythonhosted.org/packages/37/02/576ff3a6639e755c4f70997b2d315f56d6d71e0d046f4fb64cb81a3fb099/tiktoken-0.8.0.tar.gz"
sha256 "9ccbb2740f24542534369c5635cfd9b2b3c2490754a78ac8831d99f89f94eeb2"
end

resource "tqdm" do
Expand All @@ -85,6 +86,7 @@ class OpenaiWhisper < Formula

def install
ENV["LLVM_CONFIG"] = Formula["llvm@16"].opt_bin/"llvm-config"
inreplace "setup.py", "version=read_version()", "version='#{version}'"
venv = virtualenv_install_with_resources without: "numba"

# We depend on pytorch, but that's a separate formula, so install a `.pth` file to link them.
Expand Down
52 changes: 20 additions & 32 deletions Formula/p/pytorch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@ class Pytorch < Formula

desc "Tensors and dynamic neural networks"
homepage "https://pytorch.org/"
url "https://github.com/pytorch/pytorch/releases/download/v2.4.1/pytorch-v2.4.1.tar.gz"
sha256 "39666a43c0c10f5fd46c1a7ca95dc74d3bc39de2678b70066481cbf02e58384f"
url "https://github.com/pytorch/pytorch/releases/download/v2.5.1/pytorch-v2.5.1.tar.gz"
sha256 "740eb5fff95e33cfe699bad43be83523f569c7cc7f9c285c2a255416443dd266"
license "BSD-3-Clause"
revision 1

livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end

bottle do
sha256 cellar: :any, arm64_sequoia: "af8159441b06d5e515ee322c5ad5cea34b77785b3b19189ec1423c907da8dbe2"
sha256 cellar: :any, arm64_sonoma: "b81aa0d36dc3b4abf0011c1d3bbf037732c46b0b8f71bf1c9566eac9776e8456"
sha256 cellar: :any, arm64_ventura: "e3e24bec6c7ba3d8d013ecee3451fe6ef9c0fe928f2bce41741049da7a42d734"
sha256 cellar: :any, sonoma: "46b835c31dc28d562d4776e33936fa2fe98f0e9f5a46e2b329fb6e358e558eb7"
sha256 cellar: :any, ventura: "ddd63ae057e01976336f09969047eac05de9ab771aa380079aca39470cb44267"
sha256 cellar: :any_skip_relocation, x86_64_linux: "8a74d817a047a1f3242fecdf4560a8c1a659722034889cc5e36c49cf56343968"
sha256 cellar: :any, arm64_sequoia: "272e11ee6a9c46362440a85c7b03e1e43807a47a7ec684a1c49a2b4c2e958eb3"
sha256 cellar: :any, arm64_sonoma: "93759fac4d15661def7ee9d2dc23238c6d5139bfd3cbee10f192d04851899b25"
sha256 cellar: :any, arm64_ventura: "b5a89f76c078d4cee8c0b0cca64b48c3ce65fb0085dccfb0378cda08ae3c9a71"
sha256 cellar: :any, sonoma: "f4abb9fb35249fd6aa99ff4ae20b1afd1199992d93e12fc87e9a7ee25bab5b01"
sha256 cellar: :any, ventura: "569d48ec2fdd91d3791ec8521ec7b746fb871564bb6c2dd956b63defed01b6d8"
sha256 cellar: :any_skip_relocation, x86_64_linux: "ba66f6a248b31ef624cdf631e97b05e8cd69bb2ca679657498d00278507c5db5"
end

depends_on "cmake" => :build
depends_on "ninja" => :build
depends_on "python@3.12" => [:build, :test]
depends_on "python@3.13" => [:build, :test]
depends_on xcode: :build
depends_on "abseil"
depends_on "eigen"
Expand Down Expand Up @@ -57,8 +56,8 @@ class Pytorch < Formula
end

resource "markupsafe" do
url "https://files.pythonhosted.org/packages/87/5b/aae44c6655f3801e81aa3eef09dbbf012431987ba564d7231722f68df02d/MarkupSafe-2.1.5.tar.gz"
sha256 "d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b"
url "https://files.pythonhosted.org/packages/b2/97/5d42485e71dfc078108a86d6de8fa46db44a1a9295e89c5d6d4a06e23a62/markupsafe-3.0.2.tar.gz"
sha256 "ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0"
end

resource "mpmath" do
Expand All @@ -67,19 +66,13 @@ class Pytorch < Formula
end

resource "networkx" do
url "https://files.pythonhosted.org/packages/04/e6/b164f94c869d6b2c605b5128b7b0cfe912795a87fc90e78533920001f3ec/networkx-3.3.tar.gz"
sha256 "0c127d8b2f4865f59ae9cb8aafcd60b5c70f3241ebd66f7defad7c4ab90126c9"
url "https://files.pythonhosted.org/packages/36/2b/20ad9eecdda3f1b0dc63fb8f82d2ea99163dbca08bfa392594fc2ed81869/networkx-3.4.1.tar.gz"
sha256 "f9df45e85b78f5bd010993e897b4f1fdb242c11e015b101bd951e5c0e29982d8"
end

resource "opt-einsum" do
url "https://files.pythonhosted.org/packages/7d/bf/9257e53a0e7715bc1127e15063e831f076723c6cd60985333a1c18878fb8/opt_einsum-3.3.0.tar.gz"
sha256 "59f6475f77bbc37dcf7cd748519c0ec60722e91e63ca114e68821c0c54a46549"

# Backport ConfigParser fix for Python 3.12 support
patch do
url "https://github.com/dgasmith/opt_einsum/commit/7c8f193f90b6771a6b3065bb5cf6ec2747af8209.patch?full_index=1"
sha256 "7c90ac470278deca8aa9d7ecb4bb2b31a2f79928e1783ae1316fcc3aa81f348a"
end
url "https://files.pythonhosted.org/packages/8c/b9/2ac072041e899a52f20cf9510850ff58295003aa75525e58343591b0cbfb/opt_einsum-3.4.0.tar.gz"
sha256 "96ca72f1b886d148241348783498194c577fa30a8faac108586b14f1ba4473ac"
end

resource "pyyaml" do
Expand All @@ -88,13 +81,13 @@ class Pytorch < Formula
end

resource "setuptools" do
url "https://files.pythonhosted.org/packages/27/b8/f21073fde99492b33ca357876430822e4800cdf522011f18041351dfa74b/setuptools-75.1.0.tar.gz"
sha256 "d59a21b17a275fb872a9c3dae73963160ae079f1049ed956880cd7c09b120538"
url "https://files.pythonhosted.org/packages/07/37/b31be7e4b9f13b59cde9dcaeff112d401d49e0dc5b37ed4a9fc8fb12f409/setuptools-75.2.0.tar.gz"
sha256 "753bb6ebf1f465a1912e19ed1d41f403a79173a9acf66a42e7e6aec45c3c16ec"
end

resource "sympy" do
url "https://files.pythonhosted.org/packages/11/8a/5a7fd6284fa8caac23a26c9ddf9c30485a48169344b4bd3b0f02fef1890f/sympy-1.13.3.tar.gz"
sha256 "b27fd2c6530e0ab39e275fc9b683895367e51d5da91baa8d3d64db2565fec4d9"
url "https://files.pythonhosted.org/packages/ca/99/5a5b6f19ff9f083671ddf7b9632028436167cd3d33e11015754e41b249a4/sympy-1.13.1.tar.gz"
sha256 "9cebf7e04ff162015ce31c9c6c9144daa34a93bd082f54fd8f12deca4f47515f"
end

resource "typing-extensions" do
Expand All @@ -103,7 +96,7 @@ class Pytorch < Formula
end

def install
python3 = "python3.12"
python3 = "python3.13"

# Avoid building AVX512 code
inreplace "cmake/Modules/FindAVX.cmake", /^CHECK_SSE\(CXX "AVX512"/, "#\\0"
Expand All @@ -127,11 +120,6 @@ def install
ENV["USE_SYSTEM_SLEEF"] = "ON"
ENV["USE_MPS"] = "ON" if OS.mac?

# Work around superenv removing `-Werror=` but leaving `-Wno-error=` breaking flag detection
if ENV.compiler.to_s.start_with?("gcc")
inreplace "CMakeLists.txt", /^\s*append_cxx_flag_if_supported\(\s*"-Wno-error=inconsistent-missing-[^)]*\)/, ""
end

# Avoid references to Homebrew shims
inreplace "caffe2/core/macros.h.in", "${CMAKE_CXX_COMPILER}", ENV.cxx

Expand Down
25 changes: 12 additions & 13 deletions Formula/t/torchvision.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@ class Torchvision < Formula

desc "Datasets, transforms, and models for computer vision"
homepage "https://github.com/pytorch/vision"
url "https://github.com/pytorch/vision/archive/refs/tags/v0.19.1.tar.gz"
sha256 "083e75c467285595ec3eb3c7aa8493c19e53d7eb42f13046fb56a07c8897e5a8"
url "https://github.com/pytorch/vision/archive/refs/tags/v0.20.1.tar.gz"
sha256 "7e08c7f56e2c89859310e53d898f72bccc4987cd83e08cfd6303513da15a9e71"
license "BSD-3-Clause"
revision 1

livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end

bottle do
sha256 cellar: :any, arm64_sequoia: "9c465c861116f5dbec7b375f48b2fda9ad273632a372f681647ab77157d05401"
sha256 cellar: :any, arm64_sonoma: "16506991bd75837ff07807a22a4c15367d3a44d81f8dbb9e412aa46533b46e0f"
sha256 cellar: :any, arm64_ventura: "163ee42a74b4ab7c0fc3f424e29da87929a36b67c23ae409473be505c0fb8f97"
sha256 cellar: :any, sonoma: "569b195c4bde41d5ec1d0c253c38f06b6701ba49b260adf9889626c73b669499"
sha256 cellar: :any, ventura: "fdd303661561260dc204dcdfd14f9b6ae617e6b2c6416118e3e33924735cfa55"
sha256 cellar: :any_skip_relocation, x86_64_linux: "2a1090d1598b7a517694b51c14a33b835db4609fe71adfd9af7196719e8c5f07"
sha256 cellar: :any, arm64_sequoia: "ddd4155568a1a1211d0ee070cf1764c478cb528b0d1e8980282d994b9a5b7ee0"
sha256 cellar: :any, arm64_sonoma: "c4a9c19972be69f7c10698c7894b1866e2e428d89e13a688d71a51662574d0c1"
sha256 cellar: :any, arm64_ventura: "fc0f71492417e1e807e8e2e3b82f56c18c93a44df7ec944b64a436c716e4c1d3"
sha256 cellar: :any, sonoma: "9c595e870a7655759085ffd8403f5d8d189cca197d476afd3027861ecf141ef4"
sha256 cellar: :any, ventura: "50a015a4b3922e04b3de07806ac1518650da4ad4b2cf6ef7de9f39a2d8253db7"
sha256 cellar: :any_skip_relocation, x86_64_linux: "6c2039e549331051fb86453077590995dc2e1bc53c9a1253f00a967364693991"
end

depends_on "cmake" => :build
depends_on "ninja" => :build
depends_on "python@3.12" => [:build, :test]
depends_on "python@3.13" => [:build, :test]
depends_on "abseil"
depends_on "certifi"
depends_on "jpeg-turbo"
Expand All @@ -45,10 +44,10 @@ def install

jpeg = Formula["jpeg-turbo"]
inreplace "setup.py",
"(jpeg_found, jpeg_conda, jpeg_include, jpeg_lib) = find_library(\"jpeglib\", vision_include)",
"(jpeg_found, jpeg_conda, jpeg_include, jpeg_lib) = (True, False, \"#{jpeg.include}\", \"#{jpeg.lib}\")"
'jpeg_found, jpeg_include_dir, jpeg_library_dir = find_library(header="jpeglib.h")',
"jpeg_found, jpeg_include_dir, jpeg_library_dir = True, '#{jpeg.include}', '#{jpeg.lib}'"

python3 = "python3.12"
python3 = "python3.13"
venv = virtualenv_create(libexec, python3)
venv.pip_install resources

Expand Down
Loading