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

python312Packages.llama-cpp-python: enable for Darwin #374698

Merged
merged 2 commits into from
Jan 28, 2025

Conversation

booxter
Copy link
Contributor

@booxter booxter commented Jan 18, 2025

For Darwin, there's no CUDA, hence run CUDA tests only for Linux.

Also, if CUDA is used, we need gcc13 or lower, otherwise the build fails with:

unsupported GNU version! gcc versions later than 13 are not supported!

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Jan 18, 2025
@github-actions github-actions bot added 6.topic: python 10.rebuild-darwin: 1-10 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jan 18, 2025
@nix-owners nix-owners bot requested a review from kirillrdy January 18, 2025 02:36
@GaetanLepage
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 374698


x86_64-darwin

❌ 8 packages failed to build:
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

aarch64-darwin

❌ 8 packages failed to build:
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

@GaetanLepage
Copy link
Contributor

Tests are still crashing on darwin (at least in the sandbox).

@booxter
Copy link
Contributor Author

booxter commented Jan 18, 2025

@GaetanLepage I've tried to rebuild with sandbox=true and sandbox=relaxed. It passed. I also tried to run nixpkgs-review against this PR. It passed. (The full command I tried is: nixpkgs-review pr 374698 --build-args '--argstr sandbox true --rebuild' --eval local.)

Here is the log output from nixpkgs-review environment for the package.

Executing pytestCheckPhase
�[1m============================= test session starts ==============================�[0m
platform darwin -- Python 3.13.1, pytest-8.3.3, pluggy-1.5.0
rootdir: /private/tmp/nix-build-python3.13-llama-cpp-python-0.3.5.drv-0/source
configfile: pyproject.toml
testpaths: tests
�[1mcollecting ... �[0m�[1m
collecting 4 items                                                             �[0m�[1m
collected 10 items / 2 deselected / 8 selected                                 �[0m

tests/test_llama.py �[32m.�[0m�[32m.�[0m�[32m                                                   [ 25%]�[0m
tests/test_llama_chat_format.py �[32m.�[0m�[32m.�[0m�[32m                                       [ 50%]�[0m
tests/test_llama_grammar.py �[32m.�[0m�[32m.�[0m�[32m.�[0m�[32m                                          [ 87%]�[0m
tests/test_llama_speculative.py �[32m.�[0m�[32m                                        [100%]�[0m

�[32m======================= �[32m�[1m8 passed�[0m, �[33m2 deselected�[0m�[32m in 8.58s�[0m�[32m ========================�[0m
Finished executing pytestCheckPhase

Do you have a log for the failure that I could check? Thanks.


Note: the segfault message from the comment suggests that it happens when calling to llama_load_model_from_file from llama-cpp library. Do you by chance have a core dump / traceback for the segfault? You may find it in Console.app if you have access to it.

@GaetanLepage
Copy link
Contributor

Thanks for the detailed feedback @booxter.
I can still replicate the build errors when I build on the darwin community builder.

Here are the complete logs: https://paste.glepage.com/raw/fish-bat-falcon

@booxter
Copy link
Contributor Author

booxter commented Jan 27, 2025

OK I figured out what the cause of the failure on the builder machine is. The fix is ggerganov/llama.cpp#11441 ; I will backport it here later.

@booxter booxter marked this pull request as draft January 27, 2025 01:10
@booxter booxter marked this pull request as ready for review January 27, 2025 01:56
@github-actions github-actions bot added 10.rebuild-linux: 1-10 and removed 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jan 27, 2025
@booxter
Copy link
Contributor Author

booxter commented Jan 27, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 374698


x86_64-darwin

✅ 8 packages built:
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

aarch64-darwin

✅ 8 packages built:
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

@kirillrdy
Copy link
Member

@booxter please update commit message and PR title to correct attribute name, python312Packages.llama-cpp-python

@GaetanLepage
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 374698


x86_64-linux

✅ 8 packages built:
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

aarch64-linux

❌ 8 packages failed to build:
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

x86_64-darwin

✅ 8 packages built:
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

aarch64-darwin

✅ 8 packages built:
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

@GaetanLepage
Copy link
Contributor

GaetanLepage commented Jan 27, 2025

The aarch64-linux failure is unrelated (already present on master).
See #377229.

For Darwin, there's no CUDA, hence run CUDA tests only for Linux.

Also, if CUDA is used, we need gcc13 or lower, otherwise the build fails
with:

unsupported GNU version! gcc versions later than 13 are not supported!

This change also updates passthru tests so that they are defined on
linux only, since darwin has no CUDA anyway.
@booxter booxter force-pushed the llama-mama branch 2 times, most recently from 93bb916 to 8887951 Compare January 28, 2025 03:34
@ofborg ofborg bot added 2.status: merge conflict This PR has merge conflicts with the target branch and removed 2.status: merge conflict This PR has merge conflicts with the target branch labels Jan 28, 2025
@booxter booxter requested a review from GaetanLepage January 28, 2025 03:36
@booxter booxter changed the title llama-cpp-python: enable for Darwin; fix passthru tests python312Packages.llama-cpp-python: enable for Darwin Jan 28, 2025
@booxter
Copy link
Contributor Author

booxter commented Jan 28, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 374698


aarch64-linux


x86_64-darwin

✅ 8 packages built:
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

aarch64-darwin

✅ 8 packages built:
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

@GaetanLepage
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 374698


x86_64-linux

✅ 8 packages built:
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

x86_64-darwin

✅ 8 packages built:
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

aarch64-darwin

✅ 8 packages built:
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

Copy link
Contributor

@GaetanLepage GaetanLepage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SuperSandro2000 SuperSandro2000 merged commit ef8ec64 into NixOS:master Jan 28, 2025
34 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants