0 MAC
前几天经过学生优惠以及国补17K入手了mac studio,然后这两天亲自测试其模型行运用能力如何,是否支持微调、推理速度等能力。下面进入正文。
1 mac 与 unsloth
按照下面的进行安装以及测试,是可以跑通文章里面的代码。训练速度也是很快的。
注意:一定要切换分支!python版本不要太高!
mac安装unsloth_mac unsloth-CSDN博客
下载模型:我下载速度好慢!
from modelscope import snapshot_download
model_dir = snapshot_download('LLM-Research/Llama-3.2-3B-Instruct')
训练一下看看如何:跑通没有障碍,后面的文章我会继续介绍unsloth~

推理测试
文件名称换成自己的即可!
from mlx_lm import load, stream_generate
repo = "/Users/****/.cache/modelscope/hub/models/LLM-Research/Llama-3.2-3B-Instruct"
model, tokenizer = load(repo)
prompt = "你会做什么,请用100字回答"
messages = [{"role": "user", "content": prompt}]
prompt = tokenizer.apply_chat_template(
messages, add_generation_prompt=True
)
for response in stream_generate(model, tokenizer, prompt, max_tokens=512):
print(response.text, end="", flush=True)
print()
结果:我可以提供信息、答案和建议。我们可以在许多领域交流,如教育、科技、娱乐、生活tips等。您有什么问题或想讨论的主题?我会尽力帮助您。
2 总结
可以看到,经过mac可以满足微调以及推理测试,后面我会继续使用unsloth测试mac的能力。内容包含:获取文本数据、拉取大模型、使用不同的策略进行微调、对齐等过程!








![[论文阅读]TrustRAG: Enhancing Robustness and Trustworthiness in RAG](https://i-blog.csdnimg.cn/direct/054098fd90654418b06d77e29717f1a2.png)








![ubuntu系统文件误删(/lib/x86_64-linux-gnu/libc.so.6)修复方案 [成功解决]](https://i-blog.csdnimg.cn/direct/e5a0413d5a534d7884b4716bb433432c.png#pic_center)

