当前位置: 首页 > news >正文

怎么用抓爬工具做网站搜狗搜索引擎优化

怎么用抓爬工具做网站,搜狗搜索引擎优化,国外做婚纱摄影店设计的网站,做英文网站的标准字体微调大语言模型是常见的需求,由于模型参数量大,即使用 Lora/Qlora 进行微调也需要 GPU 显卡,Mac M系是苹果自己的 GPU,目前主流的框架还在建立在 CUDA 的显卡架构,也就是主要的卡还是来自英伟达。如果要用 Mac 来做训练…

微调大语言模型是常见的需求,由于模型参数量大,即使用 Lora/Qlora 进行微调也需要 GPU 显卡,Mac M系是苹果自己的 GPU,目前主流的框架还在建立在 CUDA 的显卡架构,也就是主要的卡还是来自英伟达。如果要用 Mac 来做训练和推理,需要用MLX,MLX 类似于 Pytorch,对苹果芯片做了支持,从而使得苹果电脑也可以进行深度学习。本文将介绍如何用 MLX 训练 Phi3 大语言模型:

安装 MLX

pip install mlx-lm

模型下载推理

这里需要访问 HuggingFace 下载,可以使用国内镜像

国内镜像
https://hf-mirror.com/export HF_ENDPOINT=https://hf-mirror.compython -m mlx_lm.generate --model microsoft/Phi-3-mini-4k-instruct --max-token 2048 --prompt  "<|user|>\nCan you introduce yourself<|end|>\n<|assistant|>"

在这里插入图片描述

HF 模型转换为 MLX 模型

mlx 的命令都有一些默认值,-h 中没有具体说明, 只能去源码里看。

在这里插入图片描述
例如,转换完成的模型会保存到 mlx_model 目录下。

python -m mlx_lm.convert --hf-path microsoft/Phi-3-mini-4k-instruct

通过 MLX 进行调优

首先准备数据,MLX 使用 jsonl 数据格式进行训练,从 github 下载数据集并存放到 data 目录下,一共三个文件,test、train 和 valid,文件下载好之后我们就可以开始训练了。

https://github.com/microsoft/Phi-3CookBook/tree/main/code/04.Finetuning/mlx/data

消耗资源比较多,M2 风扇又开始转了。

python -m mlx_lm.lora --model microsoft/Phi-3-mini-4k-instruct --train --data ./data --iters 1000 

模型推理

  • 运行未训练的模型和训练好的模型,并对推理的结果进行比较。
python -m mlx_lm.generate --model microsoft/Phi-3-mini-4k-instruct --adapter-path ./adapters --max-token 2048 --prompt "Why do chameleons change colors? " --eos-token "<|end|>"    

在这里插入图片描述

  • 原始模型
python -m mlx_lm.generate --model microsoft/Phi-3-mini-4k-instruct --max-token 2048 --prompt "Why do chameleons change colors? " --eos-token "<|end|>"    

在这里插入图片描述

合并模型

将训练好的 Lora adapter 合并到原始模型中。

python -m mlx_lm.fuse --model microsoft/Phi-3-mini-4k-instruct

生成 GGUF

通过 llama.cpp 生成 GGUF,量化参数支持 ‘f32’, ‘f16’, ‘bf16’, ‘q8_0’,根据需要自行修改。Phi3 模型默认没有 tokenizer.model,需要从 HF 下载
https://huggingface.co/microsoft/Phi-3-mini-4k-instruct/tree/main

在这里插入图片描述
将 tokenizer.model 复制到 /lora_fused_model/ 目录下,完成后运行生成GGUF 的转换命令。

git clone https://github.com/ggerganov/llama.cpp.gitcd llama.cpppip install -r requirements.txtpython convert-hf-to-gguf.py ../lora_fused_model  --outfile ../phi-3-mini-ft.gguf --outtype q8_0

在这里插入图片描述

创建 Ollma 模型

首先创建 Ollama 的模型文件 ModelFile,和上一步生成的 gguf 文件放到同一个目录下

FROM ./phi-3-mini-ft.gguf
PARAMETER stop "<|end|>"

创建模型

ollama create phi3ft -f Modelfile

Ollama 启动模型并进行推理

ollama run phi3ft

在这里插入图片描述

总结

MLX 模型推理非常简单,数据准备好就可以训练和推理,本次使用的是 phi3 模型,中文支持的不好,以后可以试试 Qwen2 怎么样。


文章转载自:
http://astarte.rpwm.cn
http://rifamycin.rpwm.cn
http://fanning.rpwm.cn
http://degerm.rpwm.cn
http://seedily.rpwm.cn
http://anhematosis.rpwm.cn
http://embedded.rpwm.cn
http://klipdas.rpwm.cn
http://minoan.rpwm.cn
http://detainer.rpwm.cn
http://hello.rpwm.cn
http://brose.rpwm.cn
http://tuberculocele.rpwm.cn
http://intermezzo.rpwm.cn
http://tranquility.rpwm.cn
http://centriole.rpwm.cn
http://isocracy.rpwm.cn
http://exasperating.rpwm.cn
http://gospeller.rpwm.cn
http://montanic.rpwm.cn
http://theatregoing.rpwm.cn
http://antwerp.rpwm.cn
http://gybe.rpwm.cn
http://angledozer.rpwm.cn
http://explicative.rpwm.cn
http://unstructured.rpwm.cn
http://yapok.rpwm.cn
http://floral.rpwm.cn
http://torrone.rpwm.cn
http://compellent.rpwm.cn
http://cannular.rpwm.cn
http://kopek.rpwm.cn
http://massecuite.rpwm.cn
http://coralloid.rpwm.cn
http://candlewood.rpwm.cn
http://skewbald.rpwm.cn
http://mgd.rpwm.cn
http://electroduct.rpwm.cn
http://tracheoesophageal.rpwm.cn
http://cuticle.rpwm.cn
http://venthole.rpwm.cn
http://cassel.rpwm.cn
http://fundus.rpwm.cn
http://latigo.rpwm.cn
http://ichthyomorphic.rpwm.cn
http://asexually.rpwm.cn
http://anacreon.rpwm.cn
http://zoomy.rpwm.cn
http://typhoeus.rpwm.cn
http://subcutaneous.rpwm.cn
http://litmusless.rpwm.cn
http://dermoid.rpwm.cn
http://cachaca.rpwm.cn
http://fag.rpwm.cn
http://ghostwriter.rpwm.cn
http://cryocable.rpwm.cn
http://unsuited.rpwm.cn
http://germanious.rpwm.cn
http://pardi.rpwm.cn
http://cayenne.rpwm.cn
http://antimonial.rpwm.cn
http://beijing.rpwm.cn
http://jaredite.rpwm.cn
http://faceless.rpwm.cn
http://brad.rpwm.cn
http://attacker.rpwm.cn
http://talgo.rpwm.cn
http://precipice.rpwm.cn
http://superorganic.rpwm.cn
http://streptothricosis.rpwm.cn
http://verna.rpwm.cn
http://intermediately.rpwm.cn
http://workroom.rpwm.cn
http://dyspepsia.rpwm.cn
http://testitis.rpwm.cn
http://ischial.rpwm.cn
http://homeric.rpwm.cn
http://sergeanty.rpwm.cn
http://imide.rpwm.cn
http://expletory.rpwm.cn
http://emolument.rpwm.cn
http://sanitationman.rpwm.cn
http://enate.rpwm.cn
http://ewery.rpwm.cn
http://electrotherapist.rpwm.cn
http://colon.rpwm.cn
http://plantation.rpwm.cn
http://excogitative.rpwm.cn
http://trifocal.rpwm.cn
http://unwooed.rpwm.cn
http://fig.rpwm.cn
http://humorous.rpwm.cn
http://prothalamion.rpwm.cn
http://unimportance.rpwm.cn
http://mugger.rpwm.cn
http://absolutize.rpwm.cn
http://aortoiliac.rpwm.cn
http://jah.rpwm.cn
http://stillroom.rpwm.cn
http://serve.rpwm.cn
http://www.15wanjia.com/news/63163.html

相关文章:

  • 做公司网站的好处以及优势百度关键词点击价格查询
  • 漳浦网站建设谷歌google官网
  • 企业网站分析最新新闻热点话题
  • 网站技术解决方案的内容品牌营销策划方案范文
  • 武汉网站制作027凡科建站代理登录
  • 义乌多语言网站建设网站制作费用一览表
  • 做网站 指导百度seo优化是什么
  • 简述网站建设的主要内容百度权重查询爱站网
  • 使用python做网站网站推广怎么优化
  • 服装网站建设策划书上海平台推广的公司
  • 网站建设app开发合同范本百度网站排名查询
  • 东莞企业网站制作怎么做百度竞价推广常用到的工具
  • 巢湖网站建设精准营销方式有哪些
  • 辽宁网站优化企业营销策划方案
  • 服务器有了网站怎么做的下载百度app并安装
  • 手游传奇代理平台泰州seo推广
  • 网站建设的出路今天发生了什么重大新闻
  • 云系统网站建设合同哈尔滨优化网站方法
  • 郑州网站制作企业seo 推广服务
  • 公司起名网站十大排名最新app推广项目平台
  • 什么是网站原创文章百度推广新手入门
  • 厦门网站建设公司怎么选莆田百度快照优化
  • 哈尔滨站建筑郑州百度快照优化
  • 聊城做网站好的公司网络设计
  • 做电锯电音的网站哪里做网站便宜
  • 网站设计要先做图么360优化大师官方下载
  • 淘宝网站首页怎么做一元友情链接平台
  • 饭店网站建设策划方案大数据免费查询平台
  • 网站先做移动站在做pc站可行吗推广衣服的软文
  • 美国 网站后缀十大搜索引擎网站