microsoft / BitNet

Official inference framework for 1-bit LLMs
MIT License
11.19k stars 760 forks source link

readme steps don't work for me. Fails at setup_env.py #73

Closed byjlw closed 1 week ago

byjlw commented 3 weeks ago

(.venv) PS C:\Users\jesse\Documents\source\BitNet> python setup_env.py --hf-repo HF1BitLLM/Llama3-8B-1.58-100B-tokens -q i2_s

Traceback (most recent call last):
  File "C:\Users\jesse\Documents\source\BitNet\setup_env.py", line 202, in <module>
    main()
  File "C:\Users\jesse\Documents\source\BitNet\setup_env.py", line 179, in main
    compile()
  File "C:\Users\jesse\Documents\source\BitNet\setup_env.py", line 163, in compile
    cmake_exists = subprocess.run(["cmake", "--version"], capture_output=True)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jesse\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jesse\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\jesse\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
antonovkz commented 3 weeks ago

Same

bmerkle commented 3 weeks ago

please make sure that in your build environment cmake is installed+in the path. also assert that it matches the required version from readme (3.22)

there is a issue https://github.com/microsoft/BitNet/issues/34 + PR for this problem already.

byjlw commented 3 weeks ago

installed latest version of cmake and Clang

(.venv) PS C:\Users\jesse\Documents\source\BitNet> python setup_env.py --hf-repo HF1BitLLM/Llama3-8B-1.58-100B-tokens -q i2_s
INFO:root:Compiling the code using CMake.
ERROR:root:Error occurred while running command: Command '['cmake', '-B', 'build', '-DBITNET_X86_TL2=ON', '-T', 'ClangCL']' returned non-zero exit status 1., check details in logs\generate_build_files.log

Log file entry

CMake Error at CMakeLists.txt:2 (project):
  Generator

    NMake Makefiles

  does not support toolset specification, but toolset

    ClangCL

  was specified.

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
bmerkle commented 3 weeks ago

i first start the Developer Command Prompt for VS 2022 then i check cmake and clang (see screenshot)

then i start conda conda activate bitnet-cpp

From your logoutput Command '['cmake', '-B', 'build', '-DBITNET_X86_TL2=ON', '-T', 'ClangCL']' I can see that you are using ClangCL ClangCL is the Clang compiler with a command-line interface compatible with Microsoft’s cl.exe (MSVC) compiler, which allows it to be used in environments typically meant for Visual Studio.

So please make sure that the Visual Studio clang compiler version is visible and installed:

(bitnet-cpp) C:\work\microsoft\BitNet>clang --version clang version 17.0.3 Target: i686-pc-windows-msvc Thread model: posix InstalledDir: C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\Llvm\bin

Hope you can resolve the error with this information

Image

byjlw commented 3 weeks ago

Wait this project only works if you are using Visual Studio 2022? It doesn't work at all outside of it, like VSCode?

bmerkle commented 3 weeks ago

it is C/C++ code. You have to build and compile it with a compiler (e.g. clang or clang from Visual Studio).

you should check the README :-) https://github.com/microsoft/BitNet?tab=readme-ov-file#installation

byjlw commented 3 weeks ago

Let me clarify. Do i have to buy Visual studio Pro to use this library or can i use clang and CMAKE directly? I read the readme. I don't want to buy visual studio and have clang and CMAKE installed on my machine, so i can't follow the steps to the T.

grctest commented 2 weeks ago

I used the community version of visual studio, needed to add 2 extensions to enable building, then used conda and followed the readme.

I got similar errors to you when I tried using vs code insiders & venv

Now it works for me