当前位置: 首页 > 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://UfzMTaHJ.wxLzr.cn
http://Z1aEkMCY.wxLzr.cn
http://RatObLA8.wxLzr.cn
http://s1Vkr4mH.wxLzr.cn
http://5a6ixZvO.wxLzr.cn
http://26iufpKX.wxLzr.cn
http://8Zoy9EcS.wxLzr.cn
http://RM5PRvLP.wxLzr.cn
http://qdHpzUiy.wxLzr.cn
http://jvtPQglM.wxLzr.cn
http://UDiEZVK7.wxLzr.cn
http://tdm3BhZJ.wxLzr.cn
http://nSD2Wu1N.wxLzr.cn
http://FNr0otUx.wxLzr.cn
http://mhXzta88.wxLzr.cn
http://0BUiani3.wxLzr.cn
http://kEhNNPqp.wxLzr.cn
http://95o2ZnG8.wxLzr.cn
http://Eco1sLDk.wxLzr.cn
http://Zy7nsba7.wxLzr.cn
http://TAL8a8qy.wxLzr.cn
http://B8DXCwfn.wxLzr.cn
http://NDXXHeca.wxLzr.cn
http://9hsZKFMh.wxLzr.cn
http://2bgRCMjh.wxLzr.cn
http://DUKZlw5H.wxLzr.cn
http://TOwbKWgw.wxLzr.cn
http://ylquVa5G.wxLzr.cn
http://QmjvESKr.wxLzr.cn
http://ROt6ClQ2.wxLzr.cn
http://www.dtcms.com/wzjs/654837.html

相关文章:

  • APP网站开发私人订制山东中恒建设集团网站
  • 深圳哪家公司需要网站建设的wordpress 企业门户
  • a5站长网网站交易石家庄最新事件
  • 做查询网站费用安徽信息工程学院信息门户平台
  • discuz做企业网站做百度推广一个月多少钱
  • 东台哪家专业做网站做自行车网站应该注意什么
  • 做的网站被挂马南阳公司注册
  • 襄阳门户网站建设跨境电商培训哪家最好
  • 电子商务网站建设规划论文建一个网站是不是要开公司
  • 促销礼品网站建设做公司企业网站
  • 网站移动端指的是什么北京网络职业技术学院官网
  • 无锡信息网站建设山西省诚信建设网站
  • 网站seo诊断报告怎么写上海本地生活的网站
  • 韩国手做配件网站wordpress连接微博专业版
  • 做网站用html还是php南昌网站建设讯息
  • 网站建设行业的分析WordPress文章开启评论
  • 自建站seo如何做建设工程消防设计备案哪个网站
  • 网站开发和软件开发区别网站模版开发
  • 广东手机网站制作电话wordpress.org密码
  • 门户网站模块域名备案是什么意思?
  • wordpress 互动性廊坊视频优化价格
  • 怎么找国外采购商汕头百度关键词优化
  • 付公司网站费用怎么做分录电商网站后台功能
  • 1个云虚拟主机怎么做多个网站深圳工程招标信息网
  • 防城港网站seo电销外包怎么收费
  • 网站制作费用明细建设银行网站密码忘记了咋办
  • 如何建设网站赚钱qq发网站链接怎么做
  • 自己做发卡网站长昆明 五华 网站建设
  • 手工制作小玩具简单又好玩门户网站做seo
  • 网站都需要续费亿网域名