Based on LLMFarm, we run MiniCPM on ios devices. Note that the models run on ios are quantized to 4-bit and may lose some performance. The original models can be found here.
Deploy MiniCPM on IOS
The first method is to directly download our converted model,You can skip the subsequent conversion steps.
The second method is to download the original model from the huggingface and follow the steps below to convert and quantify it.
- downloading model
- git clone https://github.com/OpenBMB/llama.cpp.git
- cd llama.cpp && make -j8
- python3 convert.py ${hf_model_dir} --vocab-type hfft --outtype f32
- ./quantize ${hf_model_dir}/ggml-model-f32.gguf ${output_dir}/minicpm-q4_1.gguf q4_1
- git clone https://github.com/OpenBMB/LLMFarm-MiniCPM.git
- cd LLMFarm-MiniCPM && git submodule update --init --recursive
- Open this project with Xcode
- Setting Siging & Capabilities
- Select a device My MaC or your iphone
- run
![image](https://private-user-images.githubusercontent.com/24504497/301368886-b44cfaf5-64c6-4eb1-a0e9-aaaa9d24cacc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQzMzQ3NjksIm5iZiI6MTcyNDMzNDQ2OSwicGF0aCI6Ii8yNDUwNDQ5Ny8zMDEzNjg4ODYtYjQ0Y2ZhZjUtNjRjNi00ZWIxLWEwZTktYWFhYTlkMjRjYWNjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIyVDEzNDc0OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRmZTdkOTYwODhhYzMxMGE1NGRiMWUyODk2MmJkOTlmYTQxOGJkZWM2NzdhYTM4MGNmOTg0Y2JlZmYwZWI2NDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Xi7vJCN45pNtQBolKIQsDbuT_alAC9fjAxnCcrzpq1g)
- add chat
- select a model
- Set template: CPM
- Start chat
![image](https://private-user-images.githubusercontent.com/24504497/301369200-46ace145-c35f-44f9-ad67-91ab84ee401e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQzMzQ3NjksIm5iZiI6MTcyNDMzNDQ2OSwicGF0aCI6Ii8yNDUwNDQ5Ny8zMDEzNjkyMDAtNDZhY2UxNDUtYzM1Zi00NGY5LWFkNjctOTFhYjg0ZWU0MDFlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIyVDEzNDc0OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIyZjUyMmU3OTIxODc4Yzk2NGIxMmE4ZDM1Mzg3N2IwNmQyMzIzOWY1OWI3OWM3ODE2MTZiMTAxNmE1ZmQwMDQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.6CFa-1oM6498KreLqeoR393qE8Z92G7k4nDmv5Jq9Vg)
![image](https://private-user-images.githubusercontent.com/24504497/301369417-d1a6bc6b-4497-4eda-8980-f3101dc92a01.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb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