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

Write instructions for Apple Mac #24

Closed
fire opened this issue Jun 27, 2023 · 12 comments
Closed

Write instructions for Apple Mac #24

fire opened this issue Jun 27, 2023 · 12 comments

Comments

@fire
Copy link

fire commented Jun 27, 2023

% uname -mps
Darwin arm64 arm

git clone https://github.com/monatis/clip.cpp.git --recurse-submodules clip.cpp
cd clip.cpp
mkdir build
cd build
cmake .. -GNinja
ninja

Error

CMake Warning at ggml/src/CMakeLists.txt:48 (message):
  Your arch is announced as x86_64, but it seems to actually be ARM64

See also ggerganov/whisper.cpp#66 (comment)

@fire
Copy link
Author

fire commented Jun 27, 2023

cmake .. -GNinja -DCMAKE_OSX_ARCHITECTURES=x86_64 seemed to work.

@monatis
Copy link
Owner

monatis commented Jun 27, 2023

Ah yes, I need to update CMakeLists.txt to handle different arches. Launching Macbook

@monatis monatis self-assigned this Jun 27, 2023
@fire
Copy link
Author

fire commented Jun 27, 2023

./bin/quantize ../../CLIP-ViT-B-32-laion2B-s34B-b79K/ggml-model-f16.bin ggml-model-quantized.bin 3
# 3 is choosing better accuracy over inference times. 

@monatis
Copy link
Owner

monatis commented Jun 27, 2023

3 is choosing better accuracy over inference times.

yes, noteworthy in the quantization section.

@fire
Copy link
Author

fire commented Jun 27, 2023

% ./bin/main --model ggml-model-quantized.bin --threads 12 --image ../../logo_dark.png --text eye
clip_model_load: loading model from 'ggml-model-quantized.bin' - please wait....................................................clip_model_load: model size =    93.92 MB / num tensors = 397
clip_model_load: model loadded

ggml_new_tensor_impl: not enough space in the context's memory pool (needed 12052448, available 8388608)
zsh: segmentation fault  ./bin/main --model ggml-model-quantized.bin --threads 12 --image  --text eye

Curious error.

% /usr/sbin/system_profiler SPHardwareDataType
Hardware:

    Hardware Overview:

      Model Name: Mac mini
      Model Identifier: Mac14,12
      Chip: Apple M2 Pro
      Total Number of Cores: 12 (8 performance and 4 efficiency)
      Memory: 32 GB
# some serials are omitted.

The contents of the build folder for when I switch to PC. https://docsend.com/view/7b9sacg2wcbu66kt

@monatis
Copy link
Owner

monatis commented Jun 28, 2023

couldn't reproduce it on Linux, will give it a try after updating CMakeLists.txt for Mac.

@fire
Copy link
Author

fire commented Jun 28, 2023

I'm closing because I was able to test on Windows. But it's still unresolved, but I have no approaches.

@fire fire closed this as completed Jun 28, 2023
@fire
Copy link
Author

fire commented Jun 28, 2023

Use the other issue to track readme documentation.

monatis added a commit that referenced this issue Jun 28, 2023
* AVX512 support, note about #24, build release by default

* Add flags to optionally disable build of examples and tests
@monatis
Copy link
Owner

monatis commented Jun 28, 2023

I couldn't reproduce it on my Macbook so couldn't help further, but I added a note at the end of the building section. So let's keep this open for now in case someone may want to help.

@monatis monatis reopened this Jun 28, 2023
@monatis monatis removed their assignment Jun 28, 2023
@Metal-joker
Copy link

Metal-joker commented Jul 10, 2023

Can not build successfully on m2 pro, could you help me out? I'm new to cpp. @monatis

mkdir build && cd build
cmake -DCLIP_NATIVE=ON ..
make

Error:

In file included from /clip.cpp/examples/common-clip.cpp:1:
/clip.cpp/examples/common-clip.h:13:46: error: a space is required between consecutive right angle brackets (use '> >')
std::map<std::string, std::vector<std::string>> get_dir_keyed_files(const std::string &path, uint32_t max_files_per_dir);


edit:
I may figure it out, I added below code in examples/CMakeLists.txt

target_compile_features(common-clip PUBLIC cxx_std_20)

Is it a bug or just local setting difference?

@monatis
Copy link
Owner

monatis commented Jul 10, 2023

Is it a bug or just local setting difference?

This error is raised when built with C++98 standards, and it shouldn't be an issue with C++11 and later. What compiler and version ar you using?

@Metal-joker
Copy link

Metal-joker commented Jul 13, 2023

Is it a bug or just local setting difference?

This error is raised when built with C++98 standards, and it shouldn't be an issue with C++11 and later. What compiler and version ar you using?

> c++ --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@monatis monatis closed this as completed Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants