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

掌握Agent设计模式:小白程序员轻松入门,收藏提升技能!

本节目标学完本课程后你应该能够理解观察者模式在Agent中的应用掌握策略模式在Agent中的实现了解其他常用的Agent设计模式实现多种设计模式的综合应用理论讲解设计模式在Agent系统中的重要性设计模式是在软件设计中反复出现的问题的可重用解决方案。在Agent系统中设计模式有助于提高代码的可维护性和可扩展性促进组件间的松耦合便于理解和复用代码支持系统的灵活性和适应性观察者模式Observer Pattern观察者模式定义了对象之间的一对多依赖关系当一个对象的状态发生改变时所有依赖于它的对象都会得到通知并自动更新。在Agent系统中观察者模式可用于环境状态变化通知Agent状态监控事件驱动的响应机制2.1 观察者模式结构Subject主题被观察的对象Observer观察者观察Subject的对象ConcreteSubject具体主题具体实现Subject的类ConcreteObserver具体观察者具体实现Observer的类策略模式Strategy Pattern策略模式定义了一系列算法并将每种算法分别放入独立的类中从而使算法的变化独立于使用它们的客户端。在Agent系统中策略模式可用于决策算法的切换行为策略的动态调整不同规划算法的选择3.1 策略模式结构Strategy策略定义算法的接口ConcreteStrategy具体策略实现算法的类Context上下文使用策略的类其他常用的Agent设计模式4.1 状态模式State Pattern允许对象在其内部状态改变时改变其行为。4.2 模板方法模式Template Method Pattern定义算法的骨架将一些步骤延迟到子类中实现。4.3 命令模式Command Pattern将请求封装为对象从而可以用不同的请求对客户进行参数化。设计思路在Agent系统中应用设计模式需要考虑模式的适用场景模式间的组合使用系统的性能影响代码的可读性和维护性代码实现下面我们将实现多种Agent设计模式from abc import ABC, abstractmethod from typing import List, Dict, Any, Optional import time import threading from enum import Enum # 观察者模式实现 class Observer(ABC): 观察者抽象类 abstractmethod def update(self, subject, event_type: str, data: Any): 当被观察对象状态改变时被调用 :param subject: 被观察的主题对象 :param event_type: 事件类型 :param data: 事件数据 pass class Subject(ABC): 主题抽象类 def __init__(self): self._observers: List[Observer] [] def attach(self, observer: Observer): 添加观察者 if observer not in self._observers: self._observers.append(observer) def detach(self, observer: Observer): 移除观察者 if observer in self._observers: self._observers.remove(observer) def notify(self, event_type: str, data: Any None): 通知所有观察者 for observer in self._observers: observer.update(self, event_type, data) class AgentMonitor(Subject): Agent监控器 - 被观察的主题 def __init__(self, agent_id: str): super().__init__() self.agent_id agent_id self.state idle self.health_score 100 self.performance_metrics {} def change_state(self, new_state: str): 改变Agent状态 old_state self.state self.state new_state print(fAgent {self.agent_id} 状态从 {old_state} 变更为 {new_state}) self.notify(state_changed, {old_state: old_state, new_state: new_state}) def update_health(self, health: int): 更新健康分数 old_health self.health_score self.health_score health print(fAgent {self.agent_id} 健康分数从 {old_health} 更新为 {health}) self.notify(health_changed, {old_health: old_health, new_health: health}) def log_metric(self, metric_name: str, value: Any): 记录性能指标 self.performance_metrics[metric_name] value self.notify(metric_updated, {metric_name: metric_name, value: value}) class Logger(Observer): 日志观察者 def __init__(self, name: str): self.name name self.logs [] def update(self, subject, event_type: str, data: Any): log_entry { timestamp: time.time(), event_type: event_type, data: data, subject_id: getattr(subject, agent_id, unknown) } self.logs.append(log_entry) print(f[{self.name}] LOG: Event {event_type} for agent {log_entry[subject_id]}, Data: {data}) class AlertSystem(Observer): 警报系统观察者 def __init__(self, threshold: int 30): self.threshold threshold self.alerts [] def update(self, subject, event_type: str, data: Any): if event_type health_changed: new_health data.get(new_health, 0) if new_health self.threshold: alert { timestamp: time.time(), agent_id: getattr(subject, agent_id, unknown), health: new_health, message: fHealth below threshold: {new_health} {self.threshold} } self.alerts.append(alert) print(f ALERT: {alert[message]}) elif event_type state_changed: new_state data.get(new_state, ) if new_state error: alert { timestamp: time.time(), agent_id: getattr(subject, agent_id, unknown), state: new_state, message: fAgent entered error state } self.alerts.append(alert) print(f ALERT: Agent {alert[agent_id]} entered error state) class PerformanceTracker(Observer): 性能追踪观察者 def __init__(self): self.metrics_history {} def update(self, subject, event_type: str, data: Any): if event_type metric_updated: metric_name data.get(metric_name) value data.get(value) agent_id getattr(subject, agent_id, unknown) if agent_id not in self.metrics_history: self.metrics_history[agent_id] {} if metric_name not in self.metrics_history[agent_id]: self.metrics_history[agent_id][metric_name] [] self.metrics_history[agent_id][metric_name].append({ timestamp: time.time(), value: value }) print(f Performance metric {metric_name} updated for agent {agent_id}: {value}) # 策略模式实现 class PlanningStrategy(ABC): 规划策略抽象类 abstractmethod def plan(self, goals: List[str], current_state: Dict[str, Any]) - List[str]: 根据目标和当前状态制定计划 :param goals: 目标列表 :param current_state: 当前状态 :return: 行动计划 pass class SimplePlanningStrategy(PlanningStrategy): 简单规划策略 def plan(self, goals: List[str], current_state: Dict[str, Any]) - List[str]: plan [] for goal in goals: if goal navigate_to_target: plan.extend([move_forward, turn_right, move_forward]) elif goal collect_resources: plan.extend([scan_area, approach_resource, collect]) elif goal avoid_obstacle: plan.extend([stop, analyze_obstacle, find_alternative_path]) elif goal communicate: plan.extend([establish_connection, send_message, wait_for_response]) else: plan.append(default_action) return plan class AdvancedPlanningStrategy(PlanningStrategy): 高级规划策略 - 考虑当前状态和环境因素 def plan(self, goals: List[str], current_state: Dict[str, Any]) - List[str]: plan [] # 根据当前状态调整计划 battery_level current_state.get(battery_level, 100) obstacle_distance current_state.get(obstacle_distance, float(inf)) target_distance current_state.get(target_distance, float(inf)) for goal in goals: if goal navigate_to_target: if battery_level 20: plan.append(return_to_base) continue if obstacle_distance 5: # 障碍物在5米以内 plan.extend([stop, scan_surroundings, plan_detour]) else: # 根据距离选择最优路径 if target_distance 50: plan.extend([move_fast, navigate_long_range]) else: plan.extend([navigate_short_range, fine_position_control]) elif goal collect_resources: if battery_level 30: plan.append(return_to_base) continue resource_density current_state.get(resource_density, 0) if resource_density 0.8: plan.extend([approach_resource, collect_efficiently]) elif resource_density 0.3: plan.extend([approach_resource, collect_normally]) else: plan.extend([scan_new_area, find_better_location]) elif goal avoid_obstacle: obstacle_size current_state.get(obstacle_size, small) if obstacle_size large: plan.extend([stop, analyze_obstacle, plan_large_detour]) else: plan.extend([small_adjustment, continue_navigation]) elif goal communicate: signal_strength current_state.get(signal_strength, 0) if signal_strength 0.3: plan.extend([find_better_signal, retry_connection]) else: plan.extend([establish_connection, send_message, verify_delivery]) return plan class LearningPlanningStrategy(PlanningStrategy): 学习型规划策略 - 基于历史经验优化规划 def __init__(self): self.experience_db {} # 存储历史经验 self.performance_history [] def plan(self, goals: List[str], current_state: Dict[str, Any]) - List[str]: # 检查是否有类似的历史经验 state_hash self._hash_state(current_state) if state_hash in self.experience_db: # 使用历史经验 best_plan self.experience_db[state_hash] print(fUsing learned plan for similar state: {best_plan}) return best_plan else: # 使用默认规划策略 default_strategy AdvancedPlanningStrategy() plan default_strategy.plan(goals, current_state) # 记录新经验这里简化实际应用中需要评估执行效果 self.experience_db[state_hash] plan print(fLearned new plan for state: {plan}) return plan def _hash_state(self, state: Dict[str, Any]) - str: 简单地哈希状态 import hashlib state_str str(sorted(state.items())) return hashlib.md5(state_str.encode()).hexdigest() def record_performance(self, state: Dict[str, Any], plan: List[str], performance: float): 记录执行性能 state_hash self._hash_state(state) self.performance_history.append({ state_hash: state_hash, plan: plan, performance: performance, timestamp: time.time() }) class AdaptiveAgent: 自适应Agent - 使用策略模式 def __init__(self, agent_id: str, initial_strategy: PlanningStrategy): self.agent_id agent_id self.strategy initial_strategy self.goals: List[str] [] self.current_state: Dict[str, Any] {} self.action_history: List[str] [] self.performance_score 1.0 def set_strategy(self, strategy: PlanningStrategy): 切换规划策略 old_strategy_type type(self.strategy).__name__ self.strategy strategy new_strategy_type type(strategy).__name__ print(fAgent {self.agent_id} 策略从 {old_strategy_type} 切换到 {new_strategy_type}) def set_goals(self, goals: List[str]): 设置目标 self.goals goals print(fAgent {self.agent_id} 设置了目标: {goals}) def update_state(self, state_update: Dict[str, Any]): 更新状态 self.current_state.update(state_update) print(fAgent {self.agent_id} 状态更新: {state_update}) def plan_actions(self) - List[str]: 制定行动计划 if not self.goals: print(fAgent {self.agent_id} 没有目标无法制定计划) return [] plan self.strategy.plan(self.goals, self.current_state) print(fAgent {self.agent_id} 制定的计划: {plan}) return plan def execute_plan(self, plan: List[str]): 执行计划 for action in plan: self.action_history.append(action) print(fAgent {self.agent_id} 执行动作: {action}) # 模拟执行时间 time.sleep(0.1) def adapt_strategy(self): 根据性能自适应调整策略 # 简单的自适应逻辑如果性能低于阈值切换到高级策略 if self.performance_score 0.5: if not isinstance(self.strategy, AdvancedPlanningStrategy): print(fAgent {self.agent_id} 性能较低切换到高级策略) self.set_strategy(AdvancedPlanningStrategy()) elif self.performance_score 0.8: if isinstance(self.strategy, SimplePlanningStrategy): print(fAgent {self.agent_id} 性能良好保持当前策略) def evaluate_performance(self) - float: 评估性能简化版本 # 基于行动历史的简单评估 if not self.action_history: return 0.5 # 计算效率避免重复动作 unique_actions len(set(self.action_history)) total_actions len(self.action_history) if total_actions 0: return 0.5 efficiency unique_actions / total_actions self.performance_score min(1.0, efficiency 0.2) # 确保至少0.2的基准分数 return self.performance_score # 状态模式实现 class AgentState(ABC): Agent状态抽象类 abstractmethod def handle(self, agent: StateMachineAgent): 处理Agent的行为 pass abstractmethod def get_state_name(self) - str: 获取状态名称 pass class IdleState(AgentState): 空闲状态 def handle(self, agent: StateMachineAgent): print(fAgent {agent.agent_id} 处于空闲状态正在监听任务...) # 检查是否有新任务 if agent.has_task(): agent.transition_to(BusyState()) def get_state_name(self) - str: return idle class BusyState(AgentState): 忙碌状态 def handle(self, agent: StateMachineAgent): print(fAgent {agent.agent_id} 正在执行任务...) # 模拟任务执行 agent.execute_current_task() # 检查任务是否完成 if agent.current_task_completed(): agent.transition_to(IdleState()) def get_state_name(self) - str: return busy class ErrorState(AgentState): 错误状态 def handle(self, agent: StateMachineAgent): print(fAgent {agent.agent_id} 处于错误状态正在尝试恢复...) # 尝试恢复 if agent.attempt_recovery(): agent.transition_to(IdleState()) else: print(fAgent {agent.agent_id} 恢复失败保持错误状态) def get_state_name(self) - str: return error class StateMachineAgent: 状态机Agent def __init__(self, agent_id: str): self.agent_id agent_id self.state IdleState() self.current_task None self.task_queue [] self.error_count 0 def transition_to(self, state: AgentState): 切换状态 old_state self.state.get_state_name() self.state state new_state state.get_state_name() print(fAgent {self.agent_id} 状态从 {old_state} 切换到 {new_state}) def handle(self): 处理当前状态 self.state.handle(self) def assign_task(self, task: str): 分配任务 self.task_queue.append(task) print(f任务 {task} 已分配给 Agent {self.agent_id}) def has_task(self) - bool: 检查是否有任务 return len(self.task_queue) 0 def execute_current_task(self): 执行当前任务 if self.task_queue: self.current_task self.task_queue.pop(0) print(fAgent {self.agent_id} 开始执行任务: {self.current_task}) # 模拟任务执行 time.sleep(0.5) print(fAgent {self.agent_id} 完成任务: {self.current_task}) self.current_task None def current_task_completed(self) - bool: 检查当前任务是否完成 return self.current_task is None def attempt_recovery(self) - bool: 尝试恢复 print(fAgent {self.agent_id} 尝试恢复...) # 简单的恢复逻辑重置错误计数 self.error_count 0 return True # 假设总是能恢复 # 命令模式实现 class Command(ABC): 命令抽象类 abstractmethod def execute(self): 执行命令 pass abstractmethod def undo(self): 撤销命令 pass class MoveCommand(Command): 移动命令 def __init__(self, agent: CommandAgent, direction: str, distance: float): self.agent agent self.direction direction self.distance distance self.previous_position agent.position def execute(self): print(fAgent {self.agent.agent_id} 执行移动命令: {self.direction} {self.distance}m) self.previous_position self.agent.position.copy() if self.direction forward: self.agent.position[1] self.distance elif self.direction backward: self.agent.position[1] - self.distance elif self.direction left: self.agent.position[0] - self.distance elif self.direction right: self.agent.position[0] self.distance print(fAgent {self.agent.agent_id} 新位置: {self.agent.position}) def undo(self): print(f撤销移动命令恢复到位置: {self.previous_position}) self.agent.position self.previous_position.copy() class RotateCommand(Command): 旋转命令 def __init__(self, agent: CommandAgent, angle: float): self.agent agent self.angle angle self.previous_angle agent.orientation def execute(self): print(fAgent {self.agent.agent_id} 执行旋转命令: {self.angle}度) self.previous_angle self.agent.orientation self.agent.orientation self.angle # 标准化角度到0-360度 self.agent.orientation % 360 print(fAgent {self.agent.agent_id} 新朝向: {self.agent.orientation}度) def undo(self): print(f撤销旋转命令恢复到朝向: {self.previous_angle}) self.agent.orientation self.previous_angle class CommandAgent: 支持命令模式的Agent def __init__(self, agent_id: str, initial_position: List[float] None): self.agent_id agent_id self.position initial_position or [0.0, 0.0] self.orientation 0.0 # 朝向单位度 self.command_history [] def execute_command(self, command: Command): 执行命令 command.execute() self.command_history.append(command) def undo_last_command(self): 撤销最后一个命令 if self.command_history: last_command self.command_history.pop() last_command.undo() else: print(没有可撤销的命令) def get_position(self) - List[float]: 获取当前位置 return self.position.copy() def get_orientation(self) - float: 获取当前朝向 return self.orientation def demo_observer_pattern(): 演示观察者模式 print( 观察者模式演示 ) # 创建Agent监控器 monitor AgentMonitor(robot_001) # 创建观察者 logger Logger(SystemLogger) alert_system AlertSystem(threshold50) perf_tracker PerformanceTracker() # 注册观察者 monitor.attach(logger) monitor.attach(alert_system) monitor.attach(perf_tracker) # 模拟状态变化 print(\n1. 状态变化:) monitor.change_state(working) monitor.change_state(maintenance) print(\n2. 健康分数变化:) monitor.update_health(80) monitor.update_health(40) # 触发警报 monitor.update_health(20) # 触发警报 print(\n3. 性能指标更新:) monitor.log_metric(response_time, 0.15) monitor.log_metric(accuracy, 0.95) # 移除观察者 monitor.detach(alert_system) print(\n4. 移除警报系统后健康变化:) monitor.update_health(10) # 不会触发警报 # 显示日志 print(f\n5. 日志观察者记录了 {len(logger.logs)} 条日志) print(f 警报系统记录了 {len(alert_system.alerts)} 条警报) print(f 性能追踪器记录了 {len(perf_tracker.metrics_history.get(robot_001, {}))} 种指标) def demo_strategy_pattern(): 演示策略模式 print(\n\n 策略模式演示 ) # 创建不同策略 simple_strategy SimplePlanningStrategy() advanced_strategy AdvancedPlanningStrategy() learning_strategy LearningPlanningStrategy() # 创建Agent agent AdaptiveAgent(navigator_001, simple_strategy) # 设置目标 goals [navigate_to_target, avoid_obstacle] agent.set_goals(goals) print(\n1. 使用简单策略:) current_state {battery_level: 80, obstacle_distance: 10} agent.update_state(current_state) plan1 agent.plan_actions() agent.execute_plan(plan1) print(\n2. 切换到高级策略:) agent.set_strategy(advanced_strategy) current_state {battery_level: 25, obstacle_distance: 3, target_distance: 60} agent.update_state(current_state) plan2 agent.plan_actions() agent.execute_plan(plan2) print(\n3. 切换到学习策略:) agent.set_strategy(learning_strategy) current_state {battery_level: 90, obstacle_distance: 15, target_distance: 25} agent.update_state(current_state) plan3 agent.plan_actions() agent.execute_plan(plan3) # 演示性能评估和自适应 print(f\n4. Agent性能评估: {agent.evaluate_performance():.2f}) agent.adapt_strategy() def demo_state_pattern(): 演示状态模式 print(\n\n 状态模式演示 ) # 创建状态机Agent agent StateMachineAgent(worker_001) print(f初始状态: {agent.state.get_state_name()}) # 模拟一系列操作 print(\n1. 分配任务状态应该改变:) agent.assign_task(clean_room) agent.handle() # 检查状态 print(f当前状态: {agent.state.get_state_name()}) print(\n2. 处理忙碌状态:) agent.handle() # 执行任务 print(f任务完成后状态: {agent.state.get_state_name()}) print(\n3. 再次分配任务:) agent.assign_task(deliver_package) agent.handle() # 检查状态 print(f分配任务后状态: {agent.state.get_state_name()}) agent.handle() # 执行任务 print(f任务完成后状态: {agent.state.get_state_name()}) def demo_command_pattern(): 演示命令模式 print(\n\n 命令模式演示 ) # 创建命令Agent agent CommandAgent(rover_001, [0, 0]) print(f初始位置: {agent.get_position()}, 朝向: {agent.get_orientation()}度) # 创建并执行命令 print(\n1. 执行移动命令:) move_cmd1 MoveCommand(agent, forward, 5.0) agent.execute_command(move_cmd1) rotate_cmd RotateCommand(agent, 90) agent.execute_command(rotate_cmd) move_cmd2 MoveCommand(agent, forward, 3.0) agent.execute_command(move_cmd2) print(f当前位置: {agent.get_position()}, 朝向: {agent.get_orientation()}度) print(\n2. 撤销命令:) print(撤销前进3米:) agent.undo_last_command() print(f位置: {agent.get_position()}) print(撤销右转90度:) agent.undo_last_command() print(f位置: {agent.get_position()}, 朝向: {agent.get_orientation()}度) print(撤销前进5米:) agent.undo_last_command() print(f最终位置: {agent.get_position()}) def demo_combined_patterns(): 演示多种模式的组合使用 print(\n\n 组合模式演示 ) # 创建一个综合Agent结合多种设计模式 class ComprehensiveAgent: def __init__(self, agent_id: str): # 使用观察者模式监控状态 self.monitor AgentMonitor(agent_id) # 使用策略模式进行规划 self.adaptive_agent AdaptiveAgent(agent_id, SimplePlanningStrategy()) # 使用状态模式管理状态 self.state_machine_agent StateMachineAgent(agent_id) # 使用命令模式执行动作 self.command_agent CommandAgent(agent_id) # 添加观察者 self.logger Logger(f{agent_id}_logger) self.monitor.attach(self.logger) def execute_task(self, task: str, environment_state: Dict[str, Any]): 执行任务的完整流程 print(f\nComprehensiveAgent {self.monitor.agent_id} 开始执行任务: {task}) # 更新监控状态 self.monitor.change_state(executing_task) # 使用策略模式制定计划 self.adaptive_agent.set_goals([task]) self.adaptive_agent.update_state(environment_state) plan self.adaptive_agent.plan_actions() # 使用状态模式管理执行状态 self.state_machine_agent.assign_task(task) # 使用命令模式执行具体动作 for action in plan: if action.startswith(move_): direction action.split(_)[1] if _ in action else forward cmd MoveCommand(self.command_agent, direction, 2.0) self.command_agent.execute_command(cmd) elif action.startswith(turn_): angle 90 if right in action else -90 cmd RotateCommand(self.command_agent, angle) self.command_agent.execute_command(cmd) # 更新监控状态 self.monitor.change_state(idle) self.monitor.update_health(90) # 演示综合Agent comp_agent ComprehensiveAgent(comp_001) # 执行不同任务 tasks_with_states [ (navigate_to_target, {battery_level: 85, target_distance: 20}), (avoid_obstacle, {obstacle_distance: 5, battery_level: 70}), (collect_resources, {resource_density: 0.6, battery_level: 50}) ] for task, state in tasks_with_states: comp_agent.execute_task(task, state) print(f\n综合Agent执行了 {len(comp_agent.logger.logs)} 个监控事件) if __name__ __main__: demo_observer_pattern() demo_strategy_pattern() demo_state_pattern() demo_command_pattern() demo_combined_patterns() print(\n Agent设计模式演示完成 ) print(本演示展示了以下设计模式在Agent系统中的应用:) print(1. 观察者模式 - 用于状态监控和事件通知) print(2. 策略模式 - 用于动态切换算法和行为策略) print(3. 状态模式 - 用于管理Agent的不同行为状态) print(4. 命令模式 - 用于封装和执行动作) print(5. 多模式组合 - 展示如何结合多种模式构建复杂Agent)实践练习扩展观察者模式实现一个分布式监控系统可以跨网络监控多个Agent。实现一个新的策略如基于机器学习的规划策略并集成到AdaptiveAgent中。创建一个复合命令模式能够将多个命令组合成一个宏命令。小结与扩展阅读本课程介绍了多种在Agent系统中常用的设计模式包括观察者模式、策略模式、状态模式和命令模式。这些模式有助于构建灵活、可维护和可扩展的Agent系统。普通人如何抓住AI大模型的风口领取方式在文末为什么要学习大模型目前AI大模型的技术岗位与能力培养随着人工智能技术的迅速发展和应用 大模型作为其中的重要组成部分 正逐渐成为推动人工智能发展的重要引擎 。大模型以其强大的数据处理和模式识别能力 广泛应用于自然语言处理 、计算机视觉 、 智能推荐等领域 为各行各业带来了革命性的改变和机遇 。目前开源人工智能大模型已应用于医疗、政务、法律、汽车、娱乐、金融、互联网、教育、制造业、企业服务等多个场景其中应用于金融、企业服务、制造业和法律领域的大模型在本次调研中占比超过30%。随着AI大模型技术的迅速发展相关岗位的需求也日益增加。大模型产业链催生了一批高薪新职业人工智能大潮已来不加入就可能被淘汰。如果你是技术人尤其是互联网从业者现在就开始学习AI大模型技术真的是给你的人生一个重要建议最后只要你真心想学习AI大模型技术这份精心整理的学习资料我愿意无偿分享给你但是想学技术去乱搞的人别来找我在当前这个人工智能高速发展的时代AI大模型正在深刻改变各行各业。我国对高水平AI人才的需求也日益增长真正懂技术、能落地的人才依旧紧缺。我也希望通过这份资料能够帮助更多有志于AI领域的朋友入门并深入学习。真诚无偿分享vx扫描下方二维码即可加上后会一个个给大家发【附赠一节免费的直播讲座技术大佬带你学习大模型的相关知识、学习思路、就业前景以及怎么结合当前的工作发展方向等欢迎大家~】大模型全套学习资料展示自我们与MoPaaS魔泊云合作以来我们不断打磨课程体系与技术内容在细节上精益求精同时在技术层面也新增了许多前沿且实用的内容力求为大家带来更系统、更实战、更落地的大模型学习体验。希望这份系统、实用的大模型学习路径能够帮助你从零入门进阶到实战真正掌握AI时代的核心技能01教学内容从零到精通完整闭环【基础理论 →RAG开发 → Agent设计 → 模型微调与私有化部署调→热门技术】5大模块内容比传统教材更贴近企业实战大量真实项目案例带你亲自上手搞数据清洗、模型调优这些硬核操作把课本知识变成真本事‌02适学人群应届毕业生‌无工作经验但想要系统学习AI大模型技术期待通过实战项目掌握核心技术。零基础转型‌非技术背景但关注AI应用场景计划通过低代码工具实现“AI行业”跨界‌。业务赋能突破瓶颈传统开发者Java/前端等学习Transformer架构与LangChain框架向AI全栈工程师转型‌。vx扫描下方二维码即可【附赠一节免费的直播讲座技术大佬带你学习大模型的相关知识、学习思路、就业前景以及怎么结合当前的工作发展方向等欢迎大家~】本教程比较珍贵仅限大家自行学习不要传播更严禁商用03入门到进阶学习路线图大模型学习路线图整体分为5个大的阶段04视频和书籍PDF合集从0到掌握主流大模型技术视频教程涵盖模型训练、微调、RAG、LangChain、Agent开发等实战方向新手必备的大模型学习PDF书单来了全是硬核知识帮你少走弯路不吹牛真有用05行业报告白皮书合集收集70报告与白皮书了解行业最新动态0690份面试题/经验AI大模型岗位面试经验总结谁学技术不是为了赚$呢找个好的岗位很重要07 deepseek部署包技巧大全由于篇幅有限只展示部分资料并且还在持续更新中…真诚无偿分享vx扫描下方二维码即可加上后会一个个给大家发【附赠一节免费的直播讲座技术大佬带你学习大模型的相关知识、学习思路、就业前景以及怎么结合当前的工作发展方向等欢迎大家~】

相关文章:

掌握Agent设计模式:小白程序员轻松入门,收藏提升技能!

本节目标 学完本课程后,你应该能够: 理解观察者模式在Agent中的应用掌握策略模式在Agent中的实现了解其他常用的Agent设计模式实现多种设计模式的综合应用 理论讲解 设计模式在Agent系统中的重要性设计模式是在软件设计中反复出现的问题的可重用解决方案…...

PyTorch图像增强实战:从torchvision.transforms基础到高级策略组合

1. 为什么图像增强是深度学习的秘密武器 第一次训练图像分类模型时,我遇到了一个令人沮丧的问题:模型在训练集上表现完美,但在测试集上准确率惨不忍睹。后来才发现,我的模型只是在死记硬背训练图片,完全没有学会真正的…...

程序员必懂的四种查找效率:O(1)、O(log n)、O(n)、O(k)

同样是查东西,为什么有人1秒,有人要1小时? 今天想和大家聊一个所有程序员都绕不开,但初学者往往一脸懵的概念——时间复杂度。 别被这个名词吓到,其实它就在我们身边。 看完今天这篇文章,你不仅能搞懂这些…...

阿里Qwen-Image-Edit-2511开箱即用:内置热门LoRA,无需调参直接出图

阿里Qwen-Image-Edit-2511开箱即用:内置热门LoRA,无需调参直接出图 1. 模型介绍 Qwen-Image-Edit-2511是阿里最新推出的图像编辑模型,作为Qwen-Image-Edit-2509的升级版本,它在多个关键领域实现了显著提升。这个模型最大的亮点在…...

15瓦至1000瓦完整量产版开关电源方案:含图纸、BOM、变压器及磁芯图纸,可直接生产

15瓦到1000瓦完整量产版开关电源方案,有图纸,bom,变压器和各种磁芯图纸,可以直接生产最近在搞开关电源量产方案的朋友有福了,这套从15W到1000W全覆盖的设计方案绝对能让你少掉几根头发。先说重点:整套方案已…...

Retinaface+CurricularFace在SpringBoot项目中的集成应用

RetinafaceCurricularFace在SpringBoot项目中的集成应用 1. 引言:企业级人脸识别的实际需求 在现代企业应用中,人脸识别技术已经广泛应用于门禁系统、考勤管理、身份验证等场景。传统的单机版人脸识别方案往往难以满足企业级应用的高并发、高可用需求。…...

3步解决中文文献管理难题:Jasminum插件提升80%科研效率

3步解决中文文献管理难题:Jasminum插件提升80%科研效率 【免费下载链接】jasminum A Zotero add-on to retrive CNKI meta data. 一个简单的Zotero 插件,用于识别中文元数据 项目地址: https://gitcode.com/gh_mirrors/ja/jasminum 在中文文献管理…...

StructBERT语义匹配工具实测:本地运行+GPU加速,中文复述识别效果惊艳

StructBERT语义匹配工具实测:本地运行GPU加速,中文复述识别效果惊艳 你有没有遇到过这样的场景?需要判断两段中文文字是不是在说同一件事,或者想在海量文本里找出那些意思相近但表述不同的句子?比如,审核用…...

RexUniNLU效果展示:同一段政府公告文本的11种NLP任务结构化输出

RexUniNLU效果展示:同一段政府公告文本的11种NLP任务结构化输出 1. 系统概览:一站式中文NLP分析利器 RexUniNLU是一个基于ModelScope DeBERTa Rex-UniNLU模型的全功能中文自然语言处理系统。这个系统的最大特点是能够用同一个模型处理十多种不同的NLP任…...

Navicat连接PostgreSQL报错authentication method 10的深度排查与解决方案

1. 遇到Navicat连接PostgreSQL报错authentication method 10怎么办? 最近在帮朋友排查一个数据库连接问题,他用Navicat Premium 12连接PostgreSQL 12时,遇到了"authentication method 10 not supported"的错误提示。这个错误看起来…...

eSIM安全验证全解析:从EID到证书链的信任构建

1. eSIM安全验证的核心:EID与证书链的信任基石 第一次接触eSIM安全体系时,我被那一串串数字证书和验证规则搞得头晕眼花。直到在某个物联网项目中踩了坑才明白,这套机制就像我们现实生活中的身份证公章组合——EID相当于设备身份证号&#xf…...

基于CW32L031与SY7200AABC的308nm紫外线治疗仪DIY全流程解析

基于CW32L031与SY7200AABC的308nm紫外线治疗仪DIY全流程解析 最近身边有朋友聊起,家里有亲人需要用到308nm紫外线进行光疗,但医院治疗费用不菲,市面上的治疗仪价格也让人望而却步。作为一名嵌入式开发者,我就在想,能不…...

罗技PUBG压枪宏技术指南:从弹道控制到参数优化的实战方案

罗技PUBG压枪宏技术指南:从弹道控制到参数优化的实战方案 【免费下载链接】logitech-pubg PUBG no recoil script for Logitech gaming mouse / 绝地求生 罗技 鼠标宏 项目地址: https://gitcode.com/gh_mirrors/lo/logitech-pubg 绝地求生(PUBG&…...

新手必看:用Ollama运行Yi-Coder-1.5B,解决编程中的常见问题

新手必看:用Ollama运行Yi-Coder-1.5B,解决编程中的常见问题 1. 为什么你需要一个本地代码助手? 写代码时,你是不是经常遇到这些情况? 脑子里有思路,但敲键盘时却卡壳,不知道某个函数的具体写…...

水墨江南模型网络安全考量:保护您的AI绘画API接口与训练数据

水墨江南模型网络安全考量:保护您的AI绘画API接口与训练数据 最近在帮一个朋友部署水墨江南这个AI绘画模型,他打算做成一个公开的API服务,让外部用户也能调用。聊着聊着,我们就发现这事儿没那么简单。模型本身效果确实惊艳&#…...

Phi-3-vision-128k-instruct开源大模型实践:构建企业专属图文智能中枢

Phi-3-vision-128k-instruct开源大模型实践:构建企业专属图文智能中枢 1. 模型介绍与核心价值 Phi-3-Vision-128K-Instruct 是微软推出的轻量级开源多模态模型,属于Phi-3模型家族的最新成员。这个模型特别适合企业构建图文智能处理系统,它能…...

RexUniNLU零样本教程:Schema递归定义在复杂事件抽取中的应用示例

RexUniNLU零样本教程:Schema递归定义在复杂事件抽取中的应用示例 1. 快速了解RexUniNLU RexUniNLU是一个基于DeBERTa架构的统一自然语言理解模型,专门针对中文场景优化。这个模型最厉害的地方在于,它不需要任何训练数据就能完成各种NLP任务…...

惊艳写实人像生成:Stable-Diffusion-v1-5-archive光影与细节控制作品展

惊艳写实人像生成:Stable-Diffusion-v1-5-archive光影与细节控制作品展 最近在玩一个挺有意思的AI模型,叫Stable-Diffusion-v1-5-archive。你可能听说过Stable Diffusion,但这个版本有点特别,它在生成那种“以假乱真”的写实人像…...

造相-Z-Image完整指南:CPU卸载+VAE分片解码防OOM实战部署

造相-Z-Image完整指南:CPU卸载VAE分片解码防OOM实战部署 想在自己的电脑上跑一个高质量的文生图模型,但总被“爆显存”劝退?特别是用RTX 4090这种顶级显卡,跑大模型、生成高分辨率图片时,显存不足(OOM&…...

SEER‘S EYE模型知识库构建:基于MySQL的向量存储与检索

SEERS EYE模型知识库构建:基于MySQL的向量存储与检索 你有没有遇到过这样的情况?公司内部有海量的产品手册、技术文档和会议纪要,当你想快速找到一个问题的答案时,要么是记不清文件在哪,要么是关键词搜出来的结果驴唇…...

零基础部署DAMOYOLO-S:保姆级Ubuntu环境与Docker配置指南

零基础部署DAMOYOLO-S:保姆级Ubuntu环境与Docker配置指南 你是不是也对目标检测模型感兴趣,想亲手部署一个试试,但一看到Linux命令和Docker配置就头大?别担心,这篇文章就是为你准备的。咱们今天不谈复杂的算法原理&am…...

Hunyuan-OCR-WEBUI快速上手:上传图片即可识别的极简操作

Hunyuan-OCR-WEBUI快速上手:上传图片即可识别的极简操作 1. 引言:为什么选择Hunyuan-OCR-WEBUI? 在日常工作和生活中,我们经常会遇到需要从图片中提取文字的场景:可能是扫描的合同文档、手写的会议笔记、或是路边拍下…...

NOKOV度量动捕软件进阶指南:刚体与Markerset的实战配置技巧

1. 刚体与Markerset的核心概念解析 刚接触动作捕捉的朋友可能会被"刚体"和"Markerset"这两个专业术语搞得一头雾水。简单来说,刚体就像我们小时候玩的木头人玩具 - 无论你怎么移动它,它的形状都不会改变。在NOKOV动捕系统中&#xf…...

ThinkPHP5.0集成美团API实战:卡券核销与撤销功能全解析

1. 为什么需要集成美团卡券核销功能 最近几年本地生活服务类应用爆发式增长,很多商家都开始使用电子卡券来替代传统的纸质优惠券。作为开发者,我们经常需要在自己的系统中对接第三方平台的卡券功能。美团作为国内领先的生活服务平台,其卡券系…...

【气象编程】基于ERA5数据的涡度平流计算与可视化实战

1. 认识ERA5数据与涡度平流 第一次接触气象数据分析的朋友可能会好奇,ERA5到底是什么?简单来说,它是欧洲中期天气预报中心(ECMWF)提供的第五代全球大气再分析数据集,相当于一个记录了地球大气状态的超级数据…...

DHT11单总线温湿度传感器在CW32F030C8T6开发板上的移植与驱动详解

DHT11单总线温湿度传感器在CW32F030C8T6开发板上的移植与驱动详解 最近在做一个环境监测的小项目,需要用到温湿度传感器,DHT11这个老朋友自然就成了首选。它价格便宜、使用简单,一根线就能搞定通信,非常适合咱们嵌入式入门学习。这…...

通义千问1.5-1.8B-Chat-GPTQ-Int4 WebUI实战:Java开发者集成SpringBoot应用

通义千问1.5-1.8B-Chat-GPTQ-Int4 WebUI实战:Java开发者集成SpringBoot应用 最近和几个做Java后端的朋友聊天,发现大家有个共同的困惑:现在AI能力这么强,但好像都是Python的天下,我们Java应用怎么才能低成本、快速地用…...

OFA-VE一键部署教程:3分钟搭建赛博风格分析系统

OFA-VE一键部署教程:3分钟搭建赛博风格分析系统 1. 开篇:为什么选择OFA-VE? 如果你正在寻找一个既酷炫又实用的视觉分析工具,OFA-VE绝对值得一试。这个来自阿里巴巴达摩院的技术,能够智能分析图像和文本之间的逻辑关…...

从零开始:用Python还原AppleAccount签名算法(附完整代码)

从零开始:用Python逆向解析AppleAccount签名机制 在iOS生态系统中,AppleAccount的签名机制一直是开发者关注的焦点。无论是自动化测试还是第三方服务集成,理解这一签名过程都至关重要。本文将带您深入探索如何通过逆向工程技术,逐…...

为什么NTT负包裹卷积比普通卷积更适合密码学?深入解析其数学本质与应用优势

为什么NTT负包裹卷积比普通卷积更适合密码学?深入解析其数学本质与应用优势 在密码学领域,多项式环上的快速乘法运算是构建高效加密方案的核心技术。传统卷积运算虽然直观,但在处理环Z[x]/(xⁿ1)上的乘法时,会面临系数膨胀和计算效…...