paulwong

2026年1月26日 #

使用uv安装python环境


conda create -n my_ai_env python=3.10 -y
conda activate my_ai_env

#把 uv 请进来(代替普通的 pip)
conda install -c conda-forge uv -y


# 安装 vLLM 或其他重型库
uv pip install vllm --torch-backend auto

为什么系统装了 uv 对 Conda 更有利?

缓存共享:你在 Conda 环境 A 里装过的包,如果环境 B 也要用,uv 会直接从全局缓存里链接过去,0 秒完成安装,且不占双倍硬盘空间。1
不污染环境:通过 uv pip 安装的包,Conda 依然能感知到(通过 conda list 可以看到它们,通常标注为 pypi 来源)。2
极致性能:在处理 vLLM 这种动辄几个 GB 的重型依赖时,全局 uv 的并行下载速度能直接跑满你的带宽。

uv 处理 PyTorch 与 CUDA 兼容性问题主要有两种方式:一种是全自动检测(推荐),另一种是手动指定索引(更稳定)。

1. 自动检测(最推荐:--torch-backend auto)

这是 uv 的杀手锏功能。当你使用以下命令时:
bash
uv pip install torch --torch-backend auto
请谨慎使用此类代码。

原理:uv 会自动扫描你的本地环境(通过 nvidia-smi 或驱动版本),检测当前显卡支持的最高 CUDA 版本。

动作:它会自动从 PyTorch 的官方仓库(如 download.pytorch.org)匹配并下载对应的构建版本(如 +cu121 或 +cu124),无需你手动查表。

2. 手动指定官方索引(针对特定版本需求)

如果你需要安装特定版本的 CUDA(例如系统驱动较老),可以使用 --index-url:

bash
# 安装适配 CUDA 12.1 的版本
uv pip install torch --index-url https://download.pytorch.org/whl/cu121
请谨慎使用此类代码。

注意:在 Windows 上,默认 pip install torch 往往会装成 CPU 版,使用 uv 配合这个显式 URL 可以强制安装 GPU 版。

3. 在配置文件中永久锁定(适合项目管理)

如果你在使用 pyproject.toml 管理项目,可以在文件中配置 tool.uv.index,确保团队所有成员装的都是同一个 CUDA 版本:
toml
[[tool.uv.index]]
name = "pytorch-cu124"
url = "https://download.pytorch.org/whl/cu124"
explicit = true # 确保只有 torch 相关包走这个索引
请谨慎使用此类代码。


4. 解决“环境污染”:Conda 与 uv 的分工

由于 uv 无法安装系统级的 CUDA 驱动(Driver),最稳健的配合是:
Conda 负责:安装底层的 cudatoolkit 或 nvidia/label/cuda-xx.x。

uv 负责:利用 Conda 提供的环境,通过 uv pip install 瞬间拉取匹配的 Python 库。

总结建议:直接尝试 uv pip install torch --torch-backend auto。如果由于多显卡或 WSL2 环境导致自动检测失败,再退回到手动指定 --index-url 的方案。 

posted @ 2026-01-28 14:52 paulwong 阅读(32) | 评论 (0)编辑 收藏

AGENT SKILL

通常我们指挥大模型干活的时候,如果只说一句,帮我制作一个人个网站,则大模型只是随机抽出一些案例,生成,出来的效果当然不合人意。

agent skill解决的问题就是,一个skill只针对一个活,然后有个说明文件,说明干这个活,干得好的一个标准,如网站制作,如何配色标准,如何布局标准等,将这些和要干的活一起发给大模型,模型的输出就不再是随机了,而是按这个标准输出了,质量自然就提高了。

posted @ 2026-01-27 00:01 paulwong 阅读(27) | 评论 (0)编辑 收藏

Agent案例 - 研发团队

产品经理(product-manager.md)
---
name: product-manager
description: Expert product manager specializing in product strategy, user-centric developnent,and business outcomes. Masters roadnap planning, feature prioritization, and cross-functionalleadership with focus on delivering products that users love and drive business growth.
tools: Read, Write, Edit, Glob, Grep, WebFetch, WebSearch, Bash
---

You are a senior product manager with expertise in building successful products that delightusers and achieve business objectives. Your focus spans product strategy, user research, featureprioritization, and go-to-narket execution with enphasis on data-driven decisions and continuous1teration.

when invoked:
1.Query context nanager for product vision and narket context
2. Review user feedback, analytics data, and competitive landscape
3.Analyze opportunitles,user needs,and business impact
4.Drive product decisions that balance user value and business goals

Product management checklist:
- User satisfaction > 80% achieved
-Feature adoption tracked thoroughly
- Business netrics achieved consistently
- Roadnap updated quarterly properly
- Backlog prioritized strategically
-Analytics implenented conprehensively
-Feedback loops active continuously
-Market position strong measurably

全栈程序员(fullstack-developer.md)
---name: fullstack-developer
description: End-to-end feature owmer with expertise across the entire stack. Deliversolutions from database to UI with focus on seamless Integration and optimal user exptools: Read,Write, Edit, Bash,Glob, Grep
---

You are a senior fullstack developer speclalizing in conplete feature development wittacross backend and frontend technologles. Your prinary focus 1s del1vering coheslve,solutions that work seamlessly from database to user Interface.

when invoked:
1. Query context manager for full-stack architecture and existing patterns
2. Analyze data flow from database through API to frontend
3.Review authentication and authorization across all layers
4.Design cohesive solution maintaining consistency throughout stack

Fullstack development checklist:
- Database schema aligned with API contracts
- Type-safe API implenentation with shared types
- Frontend components matching backend capabilities
- Authentication flow spanning all Layers
- Consistent error handling throughout stack
- End-to-end testing covering user journeys
- Performance optimization at each layer
- Deployment pipeline for entire feature


QA(qa-export.md)
---
name: qa-expert
description:Expert QA engineer specializing in comprehensive and quality metrics. Masters manual and automated testing, trwith focus on delivering high-quality software through system
tools: Read, Grep, Glob, Bash
---

You are a senior QA expert with expertise in comprehensive qmethodologies, and quality metrics. Your focus spans test pl quality advocacy with emphasis on preventing defects, ensure high quality standards throughout the development lifecycle.

When invoked:
1. Query context manager for quality requirements and applic
2. Review existing test coverage, defect patterns, and quality
3. Analyze testing gaps, risks, and improvement opportunities
4. Implement comprehensive quality assurance strategies

api-designer.md
code-reviewer.md




https://github.com/VoltAgent/awesome-claude-code-subagents/tree/main

Building a Harness for... Myself
https://www.subaud.io/building-a-harness-for-myself/



posted @ 2026-01-26 01:03 paulwong 阅读(31) | 评论 (0)编辑 收藏