在线拍卖网站源码自己怎么做团购网站首页
2026/4/18 22:20:48 网站建设 项目流程
在线拍卖网站源码,自己怎么做团购网站首页,为网站网站做推广,企业vi设计的作用与意义今天开始将开启系列AI应用开发课程#xff0c;主要基于LangChain框架基于实战项目手把手教大家如何将AI这一新时代的基础设施应用到自己开发应用中来。 当下在AI应用开发领域#xff0c;LangChain框架可以说是唯一选择。然而#xff0c;上手学习的小伙伴们大多被拦在了第一步…今天开始将开启系列AI应用开发课程主要基于LangChain框架基于实战项目手把手教大家如何将AI这一新时代的基础设施应用到自己开发应用中来。当下在AI应用开发领域LangChain框架可以说是唯一选择。然而上手学习的小伙伴们大多被拦在了第一步没有可供使用的AI大模型底座没有可供实验的环境进行实操。而各大厂商比如OpenAI提供的API需要付费不说从注册、开通到使用都有诸多的不便和限制。因此如何在本地或者私有网络中部署和使用AI大模型成为了一个亟待解决的挑战。本文将以Baichuan2-13B-Chat-4bits为例介绍如何进行AI大模型私有部署,用于LangChain开发实验实操。本次课程提纲如下今天主要降大模型部署的部分。基础环境环境配置与安装 1.python 3.8及以上版本官网安装即可 地址https://www.python.org/ 2.pytorch 1.12及以上版本推荐2.0及以上版本官网安装即可 地址https://pytorch.org/get-started/locally/ 3.建议使用CUDA 11.4及以上根据显卡匹配英伟达推荐驱动进行暗转 地址https://developer.nvidia.com/cuda-11-4-0-download-archive 4.建议使用linux环境安装本文示例基于linux环境演示 5.假定以下动作执行的当前目录为/aidev模型下载要在LangChain开发环境中部署AI大模型首先需要下载模型文件和配置文件。Baichuan2-13B-Chat-4bits模型已经上传到了huggingface这个知名的AI模型库中我们可以通过以下步骤来下载它从huggingface上下载模型及配置文件模型下载链接如下https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits在模型页面中点击右上角的Download按钮选择Download files选项。apt-get -y install -qq aria2 aria2c --console-log-levelerror -c -x 16 -s 16 -k 1M https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits/raw/main/config.json -d /content/baichuan-inc/Baichuan2-13B-Chat-4bits -o config.json aria2c --console-log-levelerror -c -x 16 -s 16 -k 1M https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits/raw/main/configuration_baichuan.py -d /content/baichuan-inc/Baichuan2-13B-Chat-4bits -o configuration_baichuan.py aria2c --console-log-levelerror -c -x 16 -s 16 -k 1M https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits/raw/main/generation_config.json -d /content/baichuan-inc/Baichuan2-13B-Chat-4bits -o generation_config.json aria2c --console-log-levelerror -c -x 16 -s 16 -k 1M https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits/raw/main/generation_utils.py -d /content/baichuan-inc/Baichuan2-13B-Chat-4bits -o generation_utils.py aria2c --console-log-levelerror -c -x 16 -s 16 -k 1M https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits/raw/main/handler.py -d /content/baichuan-inc/Baichuan2-13B-Chat-4bits -o handler.py aria2c --console-log-levelerror -c -x 16 -s 16 -k 1M https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits/raw/main/modeling_baichuan.py -d /content/baichuan-inc/Baichuan2-13B-Chat-4bits -o modeling_baichuan.py aria2c --console-log-levelerror -c -x 16 -s 16 -k 1M https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits/resolve/main/pytorch_model.bin -d /content/baichuan-inc/Baichuan2-13B-Chat-4bits -o pytorch_model.bin aria2c --console-log-levelerror -c -x 16 -s 16 -k 1M https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits/raw/main/quantizer.py -d /content/baichuan-inc/Baichuan2-13B-Chat-4bits -o quantizer.py aria2c --console-log-levelerror -c -x 16 -s 16 -k 1M https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits/raw/main/requirements.txt -d /content/baichuan-inc/Baichuan2-13B-Chat-4bits -o requirements.txt aria2c --console-log-levelerror -c -x 16 -s 16 -k 1M https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits/raw/main/special_tokens_map.json -d /content/baichuan-inc/Baichuan2-13B-Chat-4bits -o special_tokens_map.json aria2c --console-log-levelerror -c -x 16 -s 16 -k 1M https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits/raw/main/tokenization_baichuan.py -d /content/baichuan-inc/Baichuan2-13B-Chat-4bits -o tokenization_baichuan.py aria2c --console-log-levelerror -c -x 16 -s 16 -k 1M https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits/resolve/main/tokenizer.model -d /content/baichuan-inc/Baichuan2-13B-Chat-4bits -o tokenizer.model aria2c --console-log-levelerror -c -x 16 -s 16 -k 1M https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat-4bits/raw/main/tokenizer_config.json -d /content/baichuan-inc/Baichuan2-13B-Chat-4bits -o tokenizer_config.json基础依赖安装下载好模型文件和配置文件后主目录为/aidev文件目录为baichuan-inc/Baichuan2-13B-Chat-4bits备注后续启动模型会默认加载此目录请按此命名我们还需要安装一些基础的依赖库以便于在LangChain开发环境中运行模型。我们可以通过以下步骤来安装#pip安装模型运行的依赖requirment.txt文件 pip install -r baichuan-inc/Baichuan2-13B-Chat-4bits/requirements.txt这样就完成了基础依赖库的安装。模型测试安装好基础依赖库后我们可以先测试一下模型是否能够正常运行。我们可以通过以下步骤来测试基于官方示例创建模型对象并调用对话方法在当前目录即/aidev中创建一个名为app.py的文件并输入以下内容import torch from transformers import AutoModelForCausalLM, AutoTokenizer from transformers.generation.utils import GenerationConfig tokenizer AutoTokenizer.from_pretrained(baichuan-inc/Baichuan2-13B-Chat-4bits, use_fastFalse, trust_remote_codeTrue) model AutoModelForCausalLM.from_pretrained(baichuan-inc/Baichuan2-13B-Chat-4bits, device_mapauto, torch_dtypetorch.bfloat16, trust_remote_codeTrue) model.generation_config GenerationConfig.from_pretrained(baichuan-inc/Baichuan2-13B-Chat-4bits) messages [] messages.append({role: user, content: 解释一下“温故而知新”}) response model.chat(tokenizer, messages) print(response)启用测试python app.py运行效果如下图所示基于FastAPI创建模型访问接口示例测试好模型后我们已经掌握了与大模型对话的入口可以进一步基于FastAPI创建一个模型访问接口这样就可以让外部的应用或者用户通过网络来调用我们部署在LangChain开发环境中的AI大模型。我们可以通过以下步骤来创建安装uvicornpip install uvicorn在当前目录即/aidev中创建一个名为api.py的文件并输入以下内容from fastapi import FastAPI from fastapi import HTTPException from pydantic import BaseModel import torch from transformers import AutoModelForCausalLM, AutoTokenizer from transformers.generation.utils import GenerationConfig tokenizer AutoTokenizer.from_pretrained(baichuan-inc/Baichuan2-13B-Chat-4bits, use_fastFalse, trust_remote_codeTrue) model AutoModelForCausalLM.from_pretrained(baichuan-inc/Baichuan2-13B-Chat-4bits, device_mapauto, torch_dtypetorch.bfloat16, trust_remote_codeTrue) model.generation_config GenerationConfig.from_pretrained(baichuan-inc/Baichuan2-13B-Chat-4bits) app FastAPI() # This defines the data json format expected for the endpoint, change as needed class RequestItem(BaseModel): message: str app.post(/generate/) async def generate_text(request_item: RequestItem): try: # 在这里处理接收到的 JSON 请求 reqStr request_item.message messages [] messages.append({role: user, content: reqStr}) response model.chat(tokenizer,messages) return {generated_text: response} except Exception as e: raise HTTPException(status_code500, detailstr(e))启动接口uvicorn app:app --host 0.0.0.0 --port 8000 server.log 21 使用测试如下图所示总结本文介绍了如何在LangChain开发环境中准备AI大模型私有部署的技术指南以Baichuan2-13B-Chat-4bits为例分别介绍了模型下载、基础依赖安装、模型测试和基于FastAPI创建模型访问接口的步骤和代码。当然只是简单的提供对话接口的话还无法将大模型接入langchain的开发流程中。想入门 AI 大模型却找不到清晰方向备考大厂 AI 岗还在四处搜集零散资料别再浪费时间啦2026 年AI 大模型全套学习资料已整理完毕从学习路线到面试真题从工具教程到行业报告一站式覆盖你的所有需求现在全部免费分享扫码免费领取全部内容​一、学习必备100本大模型电子书26 份行业报告 600 套技术PPT帮你看透 AI 趋势想了解大模型的行业动态、商业落地案例大模型电子书这份资料帮你站在 “行业高度” 学 AI1. 100本大模型方向电子书2. 26 份行业研究报告覆盖多领域实践与趋势报告包含阿里、DeepSeek 等权威机构发布的核心内容涵盖职业趋势《AI 职业趋势报告》《中国 AI 人才粮仓模型解析》商业落地《生成式 AI 商业落地白皮书》《AI Agent 应用落地技术白皮书》领域细分《AGI 在金融领域的应用报告》《AI GC 实践案例集》行业监测《2024 年中国大模型季度监测报告》《2025 年中国技术市场发展趋势》。3. 600套技术大会 PPT听行业大咖讲实战PPT 整理自 2024-2025 年热门技术大会包含百度、腾讯、字节等企业的一线实践安全方向《端侧大模型的安全建设》《大模型驱动安全升级腾讯代码安全实践》产品与创新《大模型产品如何创新与创收》《AI 时代的新范式构建 AI 产品》多模态与 Agent《Step-Video 开源模型视频生成进展》《Agentic RAG 的现在与未来》工程落地《从原型到生产AgentOps 加速字节 AI 应用落地》《智能代码助手 CodeFuse 的架构设计》。二、求职必看大厂 AI 岗面试 “弹药库”300 真题 107 道面经直接抱走想冲字节、腾讯、阿里、蔚来等大厂 AI 岗这份面试资料帮你提前 “押题”拒绝临场慌1. 107 道大厂面经覆盖 Prompt、RAG、大模型应用工程师等热门岗位面经整理自 2021-2025 年真实面试场景包含 TPlink、字节、腾讯、蔚来、虾皮、中兴、科大讯飞、京东等企业的高频考题每道题都附带思路解析2. 102 道 AI 大模型真题直击大模型核心考点针对大模型专属考题从概念到实践全面覆盖帮你理清底层逻辑3. 97 道 LLMs 真题聚焦大型语言模型高频问题专门拆解 LLMs 的核心痛点与解决方案比如让很多人头疼的 “复读机问题”三、路线必明 AI 大模型学习路线图1 张图理清核心内容刚接触 AI 大模型不知道该从哪学起这份「AI大模型 学习路线图」直接帮你划重点不用再盲目摸索路线图涵盖 5 大核心板块从基础到进阶层层递进一步步带你从入门到进阶从理论到实战。L1阶段:启航篇丨极速破界AI新时代L1阶段了解大模型的基础知识以及大模型在各个行业的应用和分析学习理解大模型的核心原理、关键技术以及大模型应用场景。L2阶段攻坚篇丨RAG开发实战工坊L2阶段AI大模型RAG应用开发工程主要学习RAG检索增强生成包括Naive RAG、Advanced-RAG以及RAG性能评估还有GraphRAG在内的多个RAG热门项目的分析。L3阶段跃迁篇丨Agent智能体架构设计L3阶段大模型Agent应用架构进阶实现主要学习LangChain、 LIamaIndex框架也会学习到AutoGPT、 MetaGPT等多Agent系统打造Agent智能体。L4阶段精进篇丨模型微调与私有化部署L4阶段大模型的微调和私有化部署更加深入的探讨Transformer架构学习大模型的微调技术利用DeepSpeed、Lamam Factory等工具快速进行模型微调并通过Ollama、vLLM等推理部署框架实现模型的快速部署。L5阶段专题集丨特训篇 【录播课】四、资料领取全套内容免费抱走学 AI 不用再找第二份不管你是 0 基础想入门 AI 大模型还是有基础想冲刺大厂、了解行业趋势这份资料都能满足你现在只需按照提示操作就能免费领取扫码免费领取全部内容​2026 年想抓住 AI 大模型的风口别犹豫这份免费资料就是你的 “起跑线”

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询