{"id":15165771,"url":"https://github.com/howardchiang2/easy_mode_llm_inference","last_synced_at":"2026-01-19T09:34:54.886Z","repository":{"id":238805922,"uuid":"797595706","full_name":"howardchiang2/easy_mode_LLM_inference","owner":"howardchiang2","description":"简单的LLama.cpp使用","archived":false,"fork":false,"pushed_at":"2024-05-08T07:59:22.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-18T22:11:02.630Z","etag":null,"topics":["llama2","llm","llm-inference"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/howardchiang2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-08T06:36:09.000Z","updated_at":"2024-05-08T07:59:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"f6d9ec76-f3c9-4f87-a6ee-8f84af9931e8","html_url":"https://github.com/howardchiang2/easy_mode_LLM_inference","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"ed2f2c12565ba085cee56b6ed2604113824c6760"},"previous_names":["howardchiang2/easy_mode_llm_inference"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howardchiang2%2Feasy_mode_LLM_inference","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howardchiang2%2Feasy_mode_LLM_inference/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howardchiang2%2Feasy_mode_LLM_inference/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howardchiang2%2Feasy_mode_LLM_inference/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/howardchiang2","download_url":"https://codeload.github.com/howardchiang2/easy_mode_LLM_inference/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247867365,"owners_count":21009240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["llama2","llm","llm-inference"],"created_at":"2024-09-27T04:01:50.816Z","updated_at":"2026-01-19T09:34:54.879Z","avatar_url":"https://github.com/howardchiang2.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# easy_mode_LLM_inference \n硬件环境：  \napple mac M1  \npython 3.10  \n\nLLM推理最大的问题在于相应时间，过多的延迟导致用户体验降低  \n\n如何结果这个问题，参考大佬的解决办法就是通过llama.cpp(纯c++、C)  \n（refer to https://github.com/ggerganov/llama.cpp)  \n简单的LLama.cpp使用\n\n1 首先下载llama.cpp  \ngit clone https://github.com/ggerganov/llama.cpp\n\n2 编译  \ncd llama.cpp  \nmake  \n生成./main（用于推理）和./quantize（用于量化）二进制文件  \n\ngpu版  \nmacOS用户无需额外操作，llama.cpp已对ARM NEON做优化，并且已自动启用BLAS。M系列芯片推荐使用Metal启用GPU推理，显著提升速度。只需将编译命令改为:  \nLLAMA_METAL=1 make  \n\n3  下载模型  \n中文混合模型，可以直接下载gguf格式。下载ggml-model-q4_0.gguf，gguf意味着量化后的int4结果。量化大大降低了模型大小，7b的模型大概在4GB上下。  \n链接：https://huggingface.co/hfl/chinese-llama-2-7b-gguf/tree/main  \n下载后把文件放在llama.cpp下面的models/7B文件夹下  \n\n4 推理  \n在llama.cpp下运行  \n./main -m ./models/7B/ggml-model-q4_0.gguf \\  \n        -t 8 \\  \n        -n 128 \\  \n        -p 'The first president of the USA was '  \n\n\n-p 表示提示句  \n-temp 温度  \n-top-k top-k sampling  \n-t 线程的使用情况  \n-i 交互模式\n\n5 结果  \nwhat is the national flower of the USA? 美国的国花是什么 答：美国没有官方国花，不过美国的州旗上都有各自的州花。是指挥官花，在南方。美国的国花是红花木莲。红花木莲是北美洲热带的多年生灌木植物，原产于墨西哥南部、中美洲和加勒比海诸岛。红花木莲是红花木莲属（木莲属）植物中的一种。它... 问： 国花是什么 答：国花：木棉花 问： 国花是什么花？答：国花  \ntotal time =    9880.40 ms /   135 tokens\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhowardchiang2%2Feasy_mode_llm_inference","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhowardchiang2%2Feasy_mode_llm_inference","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhowardchiang2%2Feasy_mode_llm_inference/lists"}