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

网站推广公司就去柚米产品互联网推广

网站推广公司就去柚米,产品互联网推广,如何做收机微网站,中国和城乡建设部网站文章目录 安装与运行导入LLMHugginface模型-转换为-GGUF模型在指定gpu上运行model存储路径设置 ollama接口 官网 github中文介绍 安装与运行 安装教程 安装 wget https://ollama.com/download/ollama-linux-amd64.tgz tar -xzvf ollama-linux-amd64.tgz添加ollama的环境变量…

文章目录

      • 安装与运行
      • 导入LLM
        • Hugginface模型-转换为-GGUF模型
        • 在指定gpu上运行
        • model存储路径设置
      • ollama接口

官网
github中文介绍

安装与运行

安装教程
安装

wget https://ollama.com/download/ollama-linux-amd64.tgz
tar -xzvf ollama-linux-amd64.tgz

添加ollama的环境变量:export OLLAMA_HOME=/data1/ztshao/programs/ollama-linux-amd64
然后把ollama/bin添加到path里。
运行:ollama serve
检测运行:ollama -v

导入LLM

GGUF是一种存储LLM的格式。ollama选用了这种格式。所以hugginface下下来的llm需要转换为gguf格式。

Hugginface模型-转换为-GGUF模型
  1. 先下载GGUF的转换代码。
git clone https://github.com/ggerganov/llama.cpp.git
  1. 进行转换得到.gguf文件。格式为python convert_hf_to_gguf.py <iput_model_path> --outfile <out_gguf_path> --outtype f16。注意out_gguf_path的后缀为.gguf
python convert_hf_to_gguf.py ../Qwen2.5-7B-Instruct --outfile Qwen2.5-7B-Instruct.gguf --outtype f16

注意.gguf文件存储在model文件夹内部

  1. ollama运行模型
    先构造Modelfile文件:
FROM ./Qwen2.5-7B-Instruct.gguf

无量化版本:ollama create MyQwen2.5-7B-Instruct -f ./Modelfile
带量化版本:ollama create -q Q4_K_M MyQwen2.5-7B-Instruct -f ./Modelfile

  1. 查看ollama内部模型列表:ollama list
  2. 运行模型:ollama run MyQwen2.5-7B-Instruct
  3. 删除模型:ollama rm MyQwen2.5-7B-Instruct
在指定gpu上运行

失败版本:
创建./ollama_gpu_selector.sh,内容为:
参考代码

#!/bin/bash# Validate input
validate_input(){
if [[ ! $1 =~ ^[0-4](,[0-4])*$ ]];thenecho "Error: Invalid input. Please enter numbers between 0 and 4, separated by commas."
exit 1
fi
}# Update the service file with CUDA_VISIBLE_DEVICES values
update_service(){
# Check if CUDA_VISIBLE_DEVICES environment variable exists in the service file
if grep -q '^Environment="CUDA_VISIBLE_DEVICES='/etc/systemd/system/ollama.service;then
# Update the existing CUDA_VISIBLE_DEVICES valuessudo sed -i 's/^Environment="CUDA_VISIBLE_DEVICES=.*/Environment="CUDA_VISIBLE_DEVICES='"$1"'"/'/etc/systemd/system/ollama.service
else
# Add a new CUDA_VISIBLE_DEVICES environment variablesudo sed -i '/\[Service\]/a Environment="CUDA_VISIBLE_DEVICES='"$1"'"'/etc/systemd/system/ollama.service
fi# Reload and restart the systemd servicesudo systemctl daemon-reloadsudo systemctl restart ollama.serviceecho "Service updated and restarted with CUDA_VISIBLE_DEVICES=$1"
}# Check if arguments are passed
if [[ "$#" -eq 0 ]];then
# Prompt user for CUDA_VISIBLE_DEVICES values if no arguments are passedread -p "Enter CUDA_VISIBLE_DEVICES values (0-4, comma-separated): " cuda_valuesvalidate_input "$cuda_values"update_service "$cuda_values"
else
# Use arguments as CUDA_VISIBLE_DEVICES valuescuda_values="$1"validate_input "$cuda_values"update_service "$cuda_values"
fi

成功版:
我没有root权限,所以直接在.bashrc里修改了变量:

export CUDA_DEVICE_ORDER="PCI_BUS_ID"
export CUDA_VISIBLE_DEVICES=4

然后执行bashrc,重启ollama:

source ~/.bashrc
ollama serve
ollama run MyQwen2.5-7B-Instruct

查看ollama的模型运行情况:ollama ps

model存储路径设置

参考

ollama接口

http://www.dtcms.com/wzjs/38157.html

相关文章:

  • 建设网站要服务器吗微信公众号怎么创建
  • 做药品网站有哪些内容近一周新闻热点事件
  • 怎么用本机做服务器发布网站电商网站建设步骤
  • 用网站做平台网站建设图片
  • 英文网站设计哪家好网站搭建教程
  • 石家庄专业建站公司百度指数名词解释
  • 网站后台不能粘贴企业seo
  • 无锡滨湖住房与城乡建设局网站公司网站推广方法
  • 免费独立站建站平台有哪些中国免费网站服务器下载
  • 承德市隆化城乡建设局网站seo搜索引擎优化心得体会
  • 企业网站建设的目的和意义微信引流推广
  • 北京市的重点门户网站有哪些短视频培训课程
  • 模板网站zencart网页设计与制作期末作品
  • 怎么做影视类网站阳江seo
  • 国外b2b平台有哪些网站百度推广的四种收费形式
  • 网站诊断分析手机百度正式版
  • 怎样做网站代理银川网站seo
  • 常德市做公司网站的公司德州网站建设优化
  • 购买ecs就可以做网站了吗网站的seo方案
  • 导航网站模板网址搜索引擎
  • ui界面设计图系统优化软件十大排名
  • 网站应用市场设计培训机构退费法律规定
  • 怎么做简易网站优化网站搜索
  • 个人做网站有什么条件在百度怎么创建自己的网站
  • 3dmax网络营销seo培训
  • wordpress footer.php百度seo优化排名客服电话
  • 皮包设计制作培训自然搜索优化
  • 织梦免费网站模块影视后期培训机构全国排名
  • 问答类网站怎么做啊必应搜索引擎下载
  • vmware做网站步骤孝感seo