-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Make llama.cpp CURL dependency optional when building from source #3822
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -130,6 +130,10 @@ | |||||
| "q3_k_xs": "3-bit extra small quantization", | ||||||
| } | ||||||
|
|
||||||
| def has_curl(): | ||||||
| return shutil.which("curl") is not None | ||||||
|
|
||||||
| CURL_FLAG = "-DLLAMA_CURL=ON" if has_curl() else "-DLLAMA_CURL=OFF" | ||||||
|
|
||||||
| def print_quantization_methods(): | ||||||
| for key, value in ALLOWED_QUANTS.items(): | ||||||
|
|
@@ -879,8 +883,9 @@ def install_llama_cpp_make_non_blocking(): | |||||
| # Uses new CMAKE | ||||||
| n_jobs = max(int(psutil.cpu_count()), 1) # Use less CPUs since 1.5x faster | ||||||
| check = os.system( | ||||||
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF -DLLAMA_CURL=ON" | ||||||
| f"cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF {CURL_FLAG}" | ||||||
| ) | ||||||
|
|
||||||
| if check != 0: | ||||||
| raise RuntimeError( | ||||||
| f"*** Unsloth: Failed compiling llama.cpp using os.system(...) with error {check}. Please report this ASAP!" | ||||||
|
|
@@ -991,11 +996,12 @@ def install_llama_cpp_old(version = -10): | |||||
| if try_execute(commands) == "CMAKE": | ||||||
| # Instead use CMAKE | ||||||
| commands = [ | ||||||
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF -DLLAMA_CURL=ON", | ||||||
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF {CURL_FLAG}", | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the Useful? React with 👍 / 👎. |
||||||
| f"cmake --build llama.cpp/build --config Release -j{psutil.cpu_count()*2} --clean-first --target {' '.join(LLAMA_CPP_TARGETS)}", | ||||||
| "cp llama.cpp/build/bin/llama-* llama.cpp", | ||||||
| "rm -rf llama.cpp/build", | ||||||
| ] | ||||||
|
|
||||||
| try_execute(commands) | ||||||
|
|
||||||
| # Check if successful | ||||||
|
|
@@ -1037,7 +1043,7 @@ def install_llama_cpp_blocking(use_cuda = False): | |||||
| if try_execute(commands) == "CMAKE": | ||||||
| # Instead use CMAKE | ||||||
| commands = [ | ||||||
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF -DLLAMA_CURL=ON", | ||||||
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF {CURL_FLAG}", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to a previous part of the code, this string needs to be an f-string to interpolate the
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the blocking install path’s CMake fallback, Useful? React with 👍 / 👎. |
||||||
| f"cmake --build llama.cpp/build --config Release -j{psutil.cpu_count()*2} --clean-first --target {' '.join(LLAMA_CPP_TARGETS)}", | ||||||
| "cp llama.cpp/build/bin/llama-* llama.cpp", | ||||||
| "rm -rf llama.cpp/build", | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string should be an f-string to correctly interpolate the
CURL_FLAGvariable. As it is, the literal string{CURL_FLAG}will be passed to thecmakecommand, which will cause a build failure.