I installed it on Ubuntu Linux. Here some common help with that...
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 58/100
- Type d'issue
- Documentation
- Clarté
- Plutôt claire
- Activité
- Calme
- Domaine
- build-system, documentation, operating-systems
Piste de recherche
Examinez le guide Ubuntu 24.04 proposé pour docs/ubuntu-24.04-guide.md, puis vérifiez setup_env.py, src/ggml-bitnet-mad.cpp et les commandes de compilation sur Ubuntu. La tâche sera considérée comme terminée lorsqu’un guide ciblé documentera précisément les étapes liées à Clang, CMake, const-correctness, au téléchargement du modèle, à la compilation et à l’inférence.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Here's a clear, structured summary you can copy-paste (or slightly adapt) into a GitHub issue, discussion, wiki page, or README section like “Running on Ubuntu 24.04 – Common Pitfalls & Fixes”.
Feel free to change the tone, add your username, screenshots or exact dates if you want.
markdown
Running Microsoft BitNet b1.58-2B-4T on Ubuntu 24.04 (Noble Numbat) – Experience & Fixes
March 2026 – tested on Ubuntu 24.04 LTS with fresh install + many PPAs already present.
Goal: run the official repo → https://github.com/microsoft/BitNet
Model: ggml-model-i2_s.gguf from Hugging Face microsoft/BitNet-b1.58-2B-4T-gguf
Summary of problems we hit & how we solved them
1. Installing recent Clang (needed ≥18, better ≥19–20)
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
sudo apt update
sudo apt install clang-20 lld-20 cmake
→ installs clang-20 and clang++-20 (not plain clang / clang++)
2. CMake cannot find compiler → "clang is not a full path and was not found in the PATH"
Cause
setup_env.py hard-codes -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
→ looks for unversioned clang, but Ubuntu llvm.sh only creates versioned binaries.
Quick & clean workaround (worked best for us):
mkdir -p ~/bin
ln -s /usr/bin/clang-20 ~/bin/clang
ln -s /usr/bin/clang++-20 ~/bin/clang++
# Add to current session (or put in ~/.bashrc)
export PATH="$HOME/bin:$PATH"
After this which clang → /home/yourname/bin/clang and clang --version shows 20.x
3. Build fails in ggml-bitnet-mad.cpp with const-correctness error (Clang 20)
Error (line ~811):
cannot initialize a variable of type 'int8_t *' with an rvalue of type 'const int8_t *'
int8_t * y_col = y + col * by;
Cause
Clang 20 is stricter about discarding const qualifiers than Clang 18 or GCC.
Fix (minimal patch – safe because pointer is only read from)
Edit file:
nano src/ggml-bitnet-mad.cpp
Change line ~811 from:
int8_t * y_col = y + col * by;
to:
const int8_t * y_col = y + col * by;
Save → re-run
python setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s
# or directly:
cmake --build build --config Release -j$(nproc)
Alternative: use Clang 18 (less strict)
sudo apt install clang-18 lld-18
rm ~/bin/clang ~/bin/clang++
ln -s /usr/bin/clang-18 ~/bin/clang
ln -s /usr/bin/clang++-18 ~/bin/clang++
export PATH="$HOME/bin:$PATH"
rm -rf build
python setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s
4. Final working flow (after fixes)
# inside venv, in BitNet repo root
export PATH="$HOME/bin:$PATH" # if not in .bashrc yet
# Download model if not already there
huggingface-cli download microsoft/BitNet-b1.58-2B-4T-gguf \
ggml-model-i2_s.gguf --local-dir models/BitNet-b1.58-2B-4T
# Build (with the symlink trick + patch applied)
python setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s
# Run chat
python run_inference.py \
-m models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf \
-p "You are a helpful assistant" \
-cnv
Tips / Notes
- Model uses ~450–600 MB RAM → excellent for laptops / low-power machines
- Pure CPU right now (GPU support for i2_s quantization is still experimental in March 2026)
- If you want to try GPU later → build recent llama.cpp with
-DLLAMA_CUDA=ONand test the same .gguf file with--n-gpu-layers 999 - Many warnings during compile (missing prototypes, unused params, double→float) are harmless
Hope this saves someone a few hours of frustration.
Tested on: Ubuntu 24.04, Ryzen CPU, Clang 20 from apt.llvm.org
Good luck & enjoy the tiny-but-surprisingly-useful model! 🚀
Feel free to add your hardware specs, approximate tokens/s, or any extra observations.
You can put this in:
- `docs/ubuntu-24.04-guide.md`
- a pinned Discussion thread
- or even as a new issue titled “Ubuntu 24.04 installation guide – common pitfalls & solutions”
Let me know if you want it shorter, more formal, or with extra sections (e.g. GPU attempt notes). Congrats again on getting it running!
- Langage dominant
- C++
- Étoiles
- 40.6k
- Forks
- 3.8k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoft/BitNet
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
-
i2_s SIGSEGVs at n_ubatch >= 32: BLAS backend dequantises by a row stride 4x the real packed rowOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
-
Warning: `huggingface-cli` is deprecated and no longer works. Use `hf` instead.Peut-être pris @ousamabenyounes l’a pris il y a 61 jours. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Toutes les issues de microsoft/BitNet
Issues similaires
-
new contributor
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
OpenMS/OpenMS#10512 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
mesonbuild/wrapdb#2961 ·
Les mainteneurs répondent en général sous 1 jour
-
80 Instance - Raid - Northrend
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
azerothcore/azerothcore-wotlk#28075 ·
Les mainteneurs répondent en général sous 1 jour
-
SCA cis_ubuntu24-04 35664 / cis_ubuntu26-04 41664 "Ensure sudo log file exists": sudoers.d rule is missing the r: prefix, so it can never matchPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
MrNeRF/LichtFeld-Studio#3205 ·
Les mainteneurs répondent en général sous 1 jour