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

做视频网站需要什么空间吗网络广告有哪些形式

做视频网站需要什么空间吗,网络广告有哪些形式,网易企业邮箱客户端,最专业网站建目录 步骤一、下载模型 步骤二、安装模型依赖包 步骤三、写代码 步骤四、运行代码 步骤五、中文提问 & 运行代码 步骤一、下载模型 安装下载命令 pip install modelscope 下载模型 modelscope download --model Qwen/Qwen3-8B --local_dir /root/autodl-tmp/Qwen…

目录

步骤一、下载模型

步骤二、安装模型依赖包

步骤三、写代码

步骤四、运行代码

步骤五、中文提问 & 运行代码


步骤一、下载模型

安装下载命令

pip install modelscope
 

下载模型
modelscope download --model Qwen/Qwen3-8B --local_dir /root/autodl-tmp/Qwen/Qwen3-8B

步骤二、安装模型依赖包

pip install transformers peft diffusers

步骤三、写代码

from modelscope import AutoModelForCausalLM, AutoTokenizermodel_name = "/root/autodl-tmp/Qwen/Qwen3-8B"# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name,torch_dtype="auto",device_map="auto"
)
# prepare the model input
prompt = "Give me a short introduction to large language model."
messages = [{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(messages,tokenize=False,add_generation_prompt=True,enable_thinking=True # Switches between thinking and non-thinking modes. Default is True.
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)# conduct text completion
generated_ids = model.generate(**model_inputs,max_new_tokens=32768
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist() # parsing thinking content
try:# rindex finding 151668 (</think>)index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:index = 0thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")print("thinking content:", thinking_content)
print("content:", content)

步骤四、运行代码

python startqw3.py

步骤五、中文提问 & 运行代码

from modelscope import AutoModelForCausalLM, AutoTokenizermodel_name = "/root/autodl-tmp/Qwen/Qwen3-8B"# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name,torch_dtype="auto",device_map="auto"
)
# prepare the model input
prompt = "1.我今年42岁是个程序员。2.我三高,高血压高血糖高血脂。3.不算工资收入,我如何在最短的时间内赚够一百万。请用中文思考和回复"
messages = [{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(messages,tokenize=False,add_generation_prompt=True,enable_thinking=True # Switches between thinking and non-thinking modes. Default is True.
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)# conduct text completion
generated_ids = model.generate(**model_inputs,max_new_tokens=32768
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist() # parsing thinking content
try:# rindex finding 151668 (</think>)index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:index = 0thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")print("thinking content:", thinking_content)
print("content:", content)

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

相关文章:

  • 广州开发区人才交流服务中心刷关键词优化排名
  • 可以用腾讯企业邮箱域名做网站百度seo优化工具
  • 重庆网站备案大厅搜狗网页版入口
  • 电子网站搜索引擎怎么做关键词优化排名哪家好
  • 做html网站模板下载地址网站推广公司
  • 网站建设的技术难点西安网站建设方案优化
  • wordpress网站迁移教程北京搜索引擎推广服务
  • 网站建设的价值是什么seo优化的主要内容
  • 代理注册公司收费标准淘宝关键词优化怎么弄
  • 餐饮网站建设需求分析免费软文发布平台有哪些
  • 做lgoo的网站一般有哪些各大引擎搜索入口
  • 香港做批发的网站肇庆seo外包公司
  • 网站建设外包包含内容十大免费网站推广平台有哪些
  • 网站建设中如何使用字体杭州百度推广
  • 中国国际贸易单一窗口网站佛山做网站推广的公司
  • 黄骅住房和城乡建设局网站百度怎么做网站
  • 为什么不能用来名字做网站名厦门网站优化公司
  • 网站主体信息南昌seo代理商
  • 个人网站备案号可以做企业网站吗seo怎么做?
  • 美食门户类网站模版seo什么意思简单来说
  • 北京的重要的网站八百客crm登录入口
  • 三亚旅游网站建设做好网络推广的技巧
  • 设计用哪些网站合肥网站维护公司
  • 网站设置银联密码国际新闻最新消息美国
  • 自建服务器做网站河北seo基础
  • 方林装饰公司电话吉林seo外包
  • wordpress编辑框经典seo网上培训多少钱
  • 梧州网站建设公司广州信息流推广公司排名
  • 自己做网站自己做SEO百度广告联盟赚广告费
  • 能用dw做动态网站吗网站服务器ip查询