BitNet icon indicating copy to clipboard operation
BitNet copied to clipboard

Build does not use correct clang

Open kmsngh opened this issue 9 months ago • 3 comments

I downloaded and built the model (microsoft/BitNet-b1.58-2B-4T-gguf) using my Intel Mac following the instructions on README. I installed llvm using brew.

$ which clang
/usr/local/opt/llvm/bin/clang
$ clang --version
Homebrew clang version 20.1.3
Target: x86_64-apple-darwin24.4.0
Thread model: posix
InstalledDir: /usr/local/Cellar/llvm/20.1.3/bin
Configuration file: /usr/local/etc/clang/x86_64-apple-darwin24.cfg

I added the following commands to ~/.zshrc

export PATH="/usr/local/opt/llvm/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"
export CC=clang
export CXX=clang++
export LD=ld.lld
export AR=llvm-ar
export RANLIB=llvm-ranlib

However, when I run run_inference.py, it tells me that the model was built using the native clang on my machine (which is a lower version than the requirement clang>=18):

build: 3957 (5eb47b72) with Apple clang version 17.0.0 (clang-1700.0.13.3) for x86_64-apple-darwin24.4.0

Does anyone know how to fix this?

kmsngh avatar Apr 25 '25 06:04 kmsngh

You can try this in Linux:

CC=/usr/bin/clang CXX=/usr/bin/clang++ python setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s

I have successfully built it

ctrlkk avatar Apr 25 '25 10:04 ctrlkk

Hola buenas cuanto se demora la construcción días m4 CC=/opt/homebrew/opt/llvm/bin/clang CXX=/opt/homebrew/opt/llvm/bin/clang++ python setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s

carlosmolina0615 avatar Apr 27 '25 14:04 carlosmolina0615

I'm compiling with Linux in WSL, about 5 to 10 minutes, and the progress is printed in real time in the log output file, but I've forgotten where it is

Hola buenas cuanto se demora la construcción días m4 CC=/opt/homebrew/opt/llvm/bin/clang CXX=/opt/homebrew/opt/llvm/bin/clang++ python setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s

ctrlkk avatar Apr 28 '25 13:04 ctrlkk