AI智能体研发之路-工程篇(一):Docker助力AI智能体开发提效

一、引言

由于近两年云原生热,大家对docker、docker compose及k8s或多或少都有一些涉猎,即便没有实际应用肯定也耳熟能详,今天对docker及docker compose的命令集进行梳理,大家可以收藏以便之后快速查阅。

二、docker常用命令

Common Commands(常用命令):

  • run Create and run a new container from an image(从一个image镜像创建并启动一个新的container容器)
  • exec Execute a command in a running container(在一个运行的container容器执行一段命令)
  • ps List containers(列出container容器,-a列出全部容器,不加-a列出运行的容器)
  • build Build an image from a Dockerfile(从Dockerfile配置文件创建一个image镜像)
  • pull Download an image from a registry(从dockerhub等资源库下载一个image镜像)
  • push Upload an image to a registry(推送一个镜像至资源库)
  • images List images(列出images镜像)
  • login Log in to a registry(登陆进一个资源库)
  • logout Log out from a registry(从资源库推出)
  • search Search Docker Hub for images(从dockerhub中搜索images镜像)
  • version Show the Docker version information(看docker的版本信息)
  • info Display system-wide information(查看docker附带的插件信息)

Commands:

  • attach Attach local standard input, output, and error streams to a running container()
  • commit Create a new image from a container’s changes
  • cp Copy files/folders between a container and the local filesystem
  • create Create a new container
  • diff Inspect changes to files or directories on a container’s filesystem
  • events Get real time events from the server
  • export Export a container’s filesystem as a tar archive
  • history Show the history of an image
  • import Import the contents from a tarball to create a filesystem image
  • inspect Return low-level information on Docker objects(返回container或images的元数据)
  • kill Kill one or more running containers(杀死一个或更多个运行的container容器)
  • load Load an image from a tar archive or STDIN
  • logs Fetch the logs of a container(取出container容器运行日志)
  • pause Pause all processes within one or more containers
  • port List port mappings or a specific mapping for the container列出容器与宿主机的映射关系
  • rename Rename a container(重命名一个容器)
  • restart Restart one or more containers(重启一个或更多个container容器)
  • rm Remove one or more containers(删除一个或更多个container容器)
  • rmi Remove one or more images(删除一个或更多个image镜像)
  • save Save one or more images to a tar archive (streamed to STDOUT by default)
  • start Start one or more stopped containers(开始一个或更多个停止的容器)
  • stats Display a live stream of container(s) resource usage statistics
  • stop Stop one or more running containers(停止一个或多个运行中的容器)
  • tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE(对二次开发的image镜像打标签)
  • top Display the running processes of a container(显示一个容器内运行的进程)
  • unpause Unpause all processes within one or more containers
  • update Update configuration of one or more containers(更新一个或更多容器的配置)
  • wait Block until one or more containers stop, then print their exit codes

Management Commands(管理命令):

  • builder Manage builds
  • buildx* Docker Buildx (Docker Inc., v0.11.0)
  • checkpoint Manage checkpoints
  • compose* Docker Compose (Docker Inc., v2.19.1)
  • container Manage containers
  • context Manage contexts
  • dev* Docker Dev Environments (Docker Inc., v0.1.0)
  • extension* Manages Docker extensions (Docker Inc., v0.2.20)
  • image Manage images
  • init* Creates Docker-related starter files for your project (Docker Inc., v0.1.0-beta.6)
  • manifest Manage Docker image manifests and manifest lists
  • network Manage networks
  • plugin Manage plugins
  • sbom* View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  • scan* Docker Scan (Docker Inc., v0.26.0)
  • scout* Command line tool for Docker Scout (Docker Inc., 0.16.1)
  • system Manage Docker
  • trust Manage trust on Docker images
  • volume Manage volumes

Swarm Commands:

  • config Manage Swarm configs
  • node Manage Swarm nodes
  • secret Manage Swarm secrets
  • service Manage Swarm services
  • stack Manage Swarm stacks
  • swarm Manage Swarm

Global Options:

  • –config string Location of client config files (default “/Users/daoguang1/.docker”)
  • -c, --context string Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with “docker context use”)
  • -D, --debug Enable debug mode
  • -H, --host list Daemon socket to connect to
  • -l, --log-level string Set the logging level (“debug”, “info”, “warn”, “error”, “fatal”) (default “info”)
  • –tls Use TLS; implied by --tlsverify
  • –tlscacert string Trust certs signed only by this CA (default “/Users/daoguang1/.docker/ca.pem”)
  • –tlscert string Path to TLS certificate file (default “/Users/daoguang1/.docker/cert.pem”)
  • –tlskey string Path to TLS key file (default “/Users/daoguang1/.docker/key.pem”)
  • –tlsverify Use TLS and verify the remote
  • -v, --version Print version information and quit

三、docker compose常用命令

Commands(命令):

  • build Build or rebuild services
  • config Parse, resolve and render compose file in canonical format
  • cp Copy files/folders between a service container and the local filesystem
  • create Creates containers for a service.
  • down Stop and remove containers, networks
  • events Receive real time events from containers.
  • exec Execute a command in a running container.
  • images List images used by the created containers
  • kill Force stop service containers.
  • logs View output from containers
  • ls List running compose projects
  • pause Pause services
  • port Print the public port for a port binding.
  • ps List containers
  • pull Pull service images
  • push Push service images
  • restart Restart service containers
  • rm Removes stopped service containers
  • run Run a one-off command on a service.
  • start Start services
  • stop Stop services
  • top Display the running processes 列出容器组合中每个容器的进程,需要在docker-compose.yaml所在目录执行
  • unpause Unpause services
  • up Create and start containers 创建或启动容器组合,需要在docker-compose.yaml所在目录执行
  • version Show the Docker Compose version information 展示docker compose版本

Options(配置):

  •    --ansi string                Control when to print ANSI control characters ("never"|"always"|"auto") (default "auto")
    
  •    --compatibility              Run compose in backward compatibility mode
    
  •    --dry-run                    Execute command in dry run mode
    
  •    --env-file stringArray       Specify an alternate environment file.
    
  • -f, --file stringArray Compose configuration files
  •    --parallel int               Control max parallelism, -1 for unlimited (default -1)
    
  •    --profile stringArray        Specify a profile to enable
    
  •    --progress string            Set type of progress output (auto, tty, plain, quiet) (default "auto")
    
  •    --project-directory string   Specify an alternate working directory
    
  •                                 (default: the path of the, first specified, Compose file)
    
  • -p, --project-name string Project name

四、总结

现在不仅AI厂商卷,开源项目也卷的要命,基本上所有的开源项目都会将镜像上传至dockerhub,并且支持docker或者docker compose的一键部署,收藏一份命令集,随时用随时找。

如何系统的去学习大模型LLM ?

大模型时代,火爆出圈的LLM大模型让程序员们开始重新评估自己的本领。 “AI会取代那些行业?”“谁的饭碗又将不保了?”等问题热议不断。

事实上,抢你饭碗的不是AI,而是会利用AI的人。

科大讯飞、阿里、华为等巨头公司发布AI产品后,很多中小企业也陆续进场!超高年薪,挖掘AI大模型人才! 如今大厂老板们,也更倾向于会AI的人,普通程序员,还有应对的机会吗?

与其焦虑……

不如成为「掌握AI工具的技术人」,毕竟AI时代,谁先尝试,谁就能占得先机!

但是LLM相关的内容很多,现在网上的老课程老教材关于LLM又太少。所以现在小白入门就只能靠自学,学习成本和门槛很高。

针对所有自学遇到困难的同学们,我帮大家系统梳理大模型学习脉络,将这份 LLM大模型资料 分享出来:包括LLM大模型书籍、640套大模型行业报告、LLM大模型学习视频、LLM大模型学习路线、开源大模型学习教程等, 😝有需要的小伙伴,可以 扫描下方二维码领取🆓↓↓↓

👉CSDN大礼包🎁:全网最全《LLM大模型入门+进阶学习资源包》免费分享(安全链接,放心点击)👈

一、LLM大模型经典书籍

AI大模型已经成为了当今科技领域的一大热点,那以下这些大模型书籍就是非常不错的学习资源。

在这里插入图片描述

二、640套LLM大模型报告合集

这套包含640份报告的合集,涵盖了大模型的理论研究、技术实现、行业应用等多个方面。无论您是科研人员、工程师,还是对AI大模型感兴趣的爱好者,这套报告合集都将为您提供宝贵的信息和启示。(几乎涵盖所有行业)

在这里插入图片描述

三、LLM大模型系列视频教程

在这里插入图片描述

四、LLM大模型开源教程(LLaLA/Meta/chatglm/chatgpt)

在这里插入图片描述

LLM大模型学习路线

阶段1:AI大模型时代的基础理解

  • 目标:了解AI大模型的基本概念、发展历程和核心原理。

  • 内容

    • L1.1 人工智能简述与大模型起源
    • L1.2 大模型与通用人工智能
    • L1.3 GPT模型的发展历程
    • L1.4 模型工程
    • L1.4.1 知识大模型
    • L1.4.2 生产大模型
    • L1.4.3 模型工程方法论
    • L1.4.4 模型工程实践
    • L1.5 GPT应用案例

阶段2:AI大模型API应用开发工程

  • 目标:掌握AI大模型API的使用和开发,以及相关的编程技能。

  • 内容

    • L2.1 API接口
    • L2.1.1 OpenAI API接口
    • L2.1.2 Python接口接入
    • L2.1.3 BOT工具类框架
    • L2.1.4 代码示例
    • L2.2 Prompt框架
    • L2.3 流水线工程
    • L2.4 总结与展望

阶段3:AI大模型应用架构实践

  • 目标:深入理解AI大模型的应用架构,并能够进行私有化部署。

  • 内容

    • L3.1 Agent模型框架
    • L3.2 MetaGPT
    • L3.3 ChatGLM
    • L3.4 LLAMA
    • L3.5 其他大模型介绍

阶段4:AI大模型私有化部署

  • 目标:掌握多种AI大模型的私有化部署,包括多模态和特定领域模型。

  • 内容

    • L4.1 模型私有化部署概述
    • L4.2 模型私有化部署的关键技术
    • L4.3 模型私有化部署的实施步骤
    • L4.4 模型私有化部署的应用场景

这份 LLM大模型资料 包括LLM大模型书籍、640套大模型行业报告、LLM大模型学习视频、LLM大模型学习路线、开源大模型学习教程等, 😝有需要的小伙伴,可以 扫描下方二维码领取🆓↓↓↓

👉CSDN大礼包🎁:全网最全《LLM大模型入门+进阶学习资源包》免费分享(安全链接,放心点击)👈

<think>好的,我需要回答用户关于如何在Linux系统中应用人工智能技术的问题。首先,我需要回顾用户供的引用资料,看看有没有相关的信息。用户到了引用[2]和引用[4],其中引用[2]讨论了不同Linux版本的应用场景,而引用[4]则涉及在Linux上部署AI私人知识库的教程。此外,用户还到了其他引用,但可能这两个引用更相关。 接下来,我需要整理在Linux系统中应用AI技术的主要方法。根据我的知识,常见的方法包括使用AI框架、部署机器学习模型、集成AI工具链等。结合引用[4],用户可能对部署具体的AI应用,如私人知识库助手感兴趣。因此,我应该详细说明这些步骤,并引用相关的内容。 然后,我需要考虑用户可能需要的具体操作步骤,比如环境配置、工具安装、模型部署等。例如,引用[4]中到了使用One API来分发密钥,可能需要解释如何使用这些工具在Linux上搭建AI服务。同时,引用[2]到不同Linux发行版的选择,比如Debian适合稳定性要求高的场景,这也可能影响用户选择系统环境。 另外,用户的问题可能不仅限于部署,还包括开发、优化等方面。因此,我需要涵盖开发环境搭建、常用工具推荐(如TensorFlow、PyTorch)、模型训练与推理优化,以及实际应用案例,如能源系统中的AI应用(引用[3])和工业制造中的代理工作流(引用[1])。 还要注意用户到的系统级指令,比如数学公式需要用$...$和$$...$$格式,确保在回答中正确应用。例如,如果在解释算法时涉及到数学公式,需要正确使用LaTeX语法。 最后,生成相关问题时要围绕用户的核心问题展开,可能涉及性能优化、工具选择、实际应用场景等。需要确保问题具有针对性和延伸性,帮助用户进步探索。 总结步骤: 1. 环境配置:Linux发行版选择,开发环境搭建(Python、CUDA等)。 2. AI框架部署:TensorFlow、PyTorch安装,依赖库管理。 3. 模型训练与推理:使用Linux集群进行分布式训练,优化资源利用。 4. 应用部署:Docker容器化,API服务搭建(如引用[4]的One API)。 5. 实际案例:结合工业制造、能源系统等领域的应用。 6. 工具和资源推荐:引用相关文献和工具,如引用[1]和[4]。 需要确保回答结构清晰,分步骤说明,并正确引用供的资料。同时,检查LaTeX格式是否正确,数学表达式是否恰当使用。</think>在Linux系统中应用人工智能技术可通过以下结构化步骤实现,结合系统特性和开源工具链的优势: ### 、环境配置与工具选择 1. **Linux发行版选择** 推荐Ubuntu或CentOS,因其对AI框架支持更完善。例如,Ubuntu供预编译的CUDA驱动包,适合GPU加速的模型训练[^2]。对稳定性要求高的场景可选择Debian。 2. **开发环境搭建** - 安装Python环境: ```bash sudo apt install python3-pip # Debian/Ubuntu pip install virtualenv ``` - GPU支持:配置NVIDIA驱动和CUDA工具包,使用命令验证: ```bash nvidia-smi # 查看GPU状态 ``` ### 二、AI框架部署与模型开发 1. **主流框架安装** 使用PyTorch或TensorFlow,例如安装PyTorch: ```bash pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117 ``` 2. **分布式训练优化** 利用Linux集群资源,通过Horovod实现多节点训练: $$ \text{加速比} = \frac{T_{\text{单机}}}{T_{\text{多机}}} \propto \log_2(N_{\text{GPU}}) $$ 其中$N_{\text{GPU}}$为GPU数量[^1]。 ### 三、AI应用部署实践 1. **容器化部署** 使用Docker封装AI服务: ```dockerfile FROM nvidia/cuda:11.8.0-base RUN pip install fastapi uvicorn transformers CMD ["uvicorn", "app:api", "--host", "0.0.0.0"] ``` 2. **API服务搭建** 如引用[4]所述,通过One API实现多后端支持: ```bash docker run -d -p 3000:3000 -e OPENAI_API_KEY="sk-xxx" justsong/one-api ``` ### 四、实际应用场景 1. **工业制造系统** AI代理工作流可实现设备预测性维护,故障检测响应时间缩短至$t < 50\text{ms}$。 2. **能源系统优化** 如引用[3]所述,AI动态调整电网负载分配,升$10\%$以上的能源利用率。 ### 五、工具推荐 | 工具类型 | 推荐项目 | 用途 | |----------------|-----------------------|--------------------------| | 开发框架 | PyTorch, TensorFlow | 模型训练与推理 | | 部署工具 | Docker, Kubernetes | 容器化与集群管理 | | 监控工具 | Prometheus+Grafana | 资源使用与性能分析 |
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值