Z-Image-Turbo-rinaiqiao-huiyewunv实操指南:Streamlit缓存机制与多会话并发支持

news2026/3/15 16:04:48
Z-Image-Turbo-rinaiqiao-huiyewunv实操指南Streamlit缓存机制与多会话并发支持1. 引言当专属画师遇上高并发访问想象一下你部署了一个专属的二次元人物绘图工具用户们正兴致勃勃地创作他们心中的辉夜大小姐。突然三五个人同时点击了生成按钮界面开始卡顿加载圈转个不停甚至有人直接遇到了错误提示。这场景是不是很熟悉这就是我们今天要解决的核心问题如何让基于Streamlit的AI绘图工具在多人同时使用时依然流畅稳定Z-Image-Turbo-rinaiqiao-huiyewunv是一个基于Tongyi-MAI Z-Image底座模型开发的专属二次元人物绘图工具。它通过注入辉夜大小姐日奈娇的微调权重让你能在本地电脑上快速生成高质量的二次元人物图像。工具本身在单用户场景下表现优秀但一旦面临多用户并发访问性能瓶颈就会显现。本文将带你深入理解Streamlit的缓存机制并手把手教你如何为这个工具添加多会话并发支持。读完本文你将掌握Streamlit缓存的核心原理与适用场景如何为AI模型加载和推理过程添加缓存多会话并发访问的常见问题与解决方案实际代码改造与性能优化技巧无论你是工具的开发者还是使用者理解这些机制都能帮助你获得更流畅的创作体验。2. 理解Streamlit的缓存机制2.1 缓存为什么重要在深入代码之前我们先来理解一个基本问题为什么需要缓存以Z-Image-Turbo工具为例每次用户访问页面时Streamlit都会从头到尾重新执行整个脚本。这意味着模型重复加载每次生成图片都要重新加载几十GB的模型文件显存重复占用多个会话会争抢有限的GPU显存计算资源浪费相同的参数配置却要重复执行推理结果就是速度慢、显存爆、体验差。缓存的作用就是记住那些耗时的计算结果当相同的输入再次出现时直接返回之前计算好的结果而不是重新计算。2.2 Streamlit的两种缓存装饰器Streamlit提供了两种主要的缓存装饰器它们适用于不同的场景st.cache_data- 适合缓存数据st.cache_data def load_model_weights(weight_path): # 加载微调权重文件 # 这个函数只会在weight_path变化时重新执行 return weightsst.cache_resource- 适合缓存资源st.cache_resource def init_pipeline(): # 初始化Stable Diffusion管道 # 这个对象会在所有会话间共享 return pipeline两者的关键区别在于cache_data缓存函数的返回值数据适合纯函数cache_resource缓存函数返回的对象资源适合数据库连接、模型管道等对于AI模型加载我们通常使用st.cache_resource因为模型管道是一个需要在多个会话间共享的重型资源。2.3 缓存的生效条件缓存不是无条件生效的它依赖于几个关键因素函数名相同的函数名输入参数相同的参数值函数体相同的代码逻辑外部依赖相同的外部变量如果这些条件中的任何一个发生变化缓存就会失效函数会重新执行。3. 为Z-Image-Turbo添加模型缓存3.1 识别需要缓存的耗时操作首先我们需要分析Z-Image-Turbo工具中哪些操作最耗时最值得缓存模型管道初始化加载Z-Image底座模型和微调权重权重文件读取从safetensors文件加载微调权重默认提示词加载读取预设的人物特征描述其中模型管道初始化是最耗时的可能占用几十秒到几分钟的时间。这是我们缓存优化的首要目标。3.2 改造模型加载函数让我们看看原始的模型加载代码可能是什么样子# 原始代码 - 每次调用都重新加载 def load_model(): # 1. 加载底座模型 model StableDiffusionPipeline.from_pretrained( Tongyi-MAI/Z-Image, torch_dtypetorch.bfloat16, safety_checkerNone ) # 2. 加载微调权重 weights torch.load(rinaiqiao_huiyewunv.safetensors) # 3. 权重适配与注入 # 清理权重前缀适配模型结构 cleaned_weights {} for k, v in weights.items(): new_key k.replace(transformer., ).replace(model., ) cleaned_weights[new_key] v # 4. 注入权重忽略不匹配的层 model.unet.load_state_dict(cleaned_weights, strictFalse) # 5. 优化设置 model.enable_model_cpu_offload() model.to(cuda) return model现在我们为它添加缓存# 改造后 - 添加缓存支持 st.cache_resource def load_model_cached(): 带缓存的模型加载函数 这个函数只会在第一次调用时执行后续调用直接返回缓存的结果 st.info( 正在加载二次元绘图引擎首次加载较慢...) # 1. 加载底座模型 model StableDiffusionPipeline.from_pretrained( Tongyi-MAI/Z-Image, torch_dtypetorch.bfloat16, safety_checkerNone ) # 2. 加载微调权重也可以单独缓存 weights load_weights_cached(rinaiqiao_huiyewunv.safetensors) # 3. 权重适配与注入 cleaned_weights {} for k, v in weights.items(): new_key k.replace(transformer., ).replace(model., ) cleaned_weights[new_key] v # 4. 注入权重 model.unet.load_state_dict(cleaned_weights, strictFalse) # 5. 优化设置 model.enable_model_cpu_offload() # 注意这里不调用 model.to(cuda)因为enable_model_cpu_offload会按需移动 st.success(✅ 人物模型加载完成) return model # 权重加载也可以单独缓存 st.cache_data def load_weights_cached(weight_path): 缓存权重文件加载 return torch.load(weight_path)3.3 在Streamlit应用中使用缓存模型在Streamlit的主函数中我们这样使用缓存后的模型def main(): st.set_page_config(layoutwide, page_title辉夜大小姐专属画师) # 初始化侧边栏参数 with st.sidebar: st.header( 绘画参数设置) prompt st.text_area( 提示词 (Prompt), valuemasterpiece, best quality, 1girl, black hair, red eyes, school uniform, ..., height100 ) # ... 其他参数设置 # 主内容区 col1, col2 st.columns([1, 2]) with col1: st.header(参数配置) # 参数配置表单 with col2: st.header(生成结果) if st.button( 生成人物写真, typeprimary): # 获取缓存中的模型首次会加载后续直接使用 model load_model_cached() # 显示生成状态 with st.spinner(画师正在奋笔疾书中...): # 执行推理 image model( promptprompt, negative_promptst.session_state.get(negative_prompt, ), num_inference_stepssteps, guidance_scalecfg_scale ).images[0] # 显示结果 st.image(image, use_column_widthTrue) # 资源清理 gc.collect() torch.cuda.empty_cache()4. 处理多会话并发访问4.1 理解Streamlit的会话机制Streamlit为每个浏览器标签页创建一个独立的会话session。默认情况下每个会话有自己的状态st.session_state每个会话独立执行脚本缓存是跨会话共享的使用st.cache_resource时这带来了一个关键优势多个用户可以共享同一个模型实例大大减少了显存占用。4.2 并发访问的常见问题即使有了缓存多用户并发访问时仍可能遇到问题GPU显存竞争多个会话同时推理显存不足模型推理冲突多个请求同时调用模型的generate方法状态管理混乱不同用户的生成状态互相干扰4.3 添加并发控制机制为了解决这些问题我们需要添加一些并发控制import threading from queue import Queue import time # 创建一个任务队列和锁 inference_queue Queue() inference_lock threading.Lock() class InferenceTask: 推理任务封装类 def __init__(self, task_id, prompt, negative_prompt, steps, cfg_scale): self.task_id task_id self.prompt prompt self.negative_prompt negative_prompt self.steps steps self.cfg_scale cfg_scale self.result None self.status pending # pending, processing, completed, failed self.created_at time.time() def inference_worker(): 后台推理工作线程 # 加载模型会使用缓存 model load_model_cached() while True: # 从队列获取任务 task inference_queue.get() if task is None: # 终止信号 break try: task.status processing # 使用锁确保同一时间只有一个推理在执行 with inference_lock: # 执行推理 result model( prompttask.prompt, negative_prompttask.negative_prompt, num_inference_stepstask.steps, guidance_scaletask.cfg_scale ).images[0] task.result result task.status completed # 清理显存 gc.collect() torch.cuda.empty_cache() except Exception as e: task.status failed task.result str(e) finally: inference_queue.task_done() # 启动工作线程在Streamlit应用启动时执行 worker_thread threading.Thread(targetinference_worker, daemonTrue) worker_thread.start()4.4 在Streamlit中集成任务队列现在我们需要修改Streamlit应用使用任务队列来处理生成请求def main(): # ... 页面配置和参数设置代码 ... # 初始化会话状态 if task_id not in st.session_state: st.session_state.task_id 0 if my_tasks not in st.session_state: st.session_state.my_tasks {} with col2: st.header(生成结果) if st.button( 生成人物写真, typeprimary): # 创建新任务 task_id st.session_state.task_id st.session_state.task_id 1 task InferenceTask( task_idtask_id, promptprompt, negative_promptnegative, stepssteps, cfg_scalecfg_scale ) # 保存任务到会话状态 st.session_state.my_tasks[task_id] task # 添加到队列 inference_queue.put(task) st.info(f 任务 #{task_id} 已加入队列请稍候...) # 显示当前用户的任务状态 st.subheader(我的任务列表) for task_id, task in list(st.session_state.my_tasks.items()): with st.expander(f任务 #{task_id} - 状态: {task.status}, expandedTrue): if task.status completed: st.image(task.result, use_column_widthTrue) st.success(✅ 生成完成) elif task.status processing: st.warning(⏳ 正在生成中...) st.progress(0.5) # 模拟进度 elif task.status failed: st.error(f❌ 生成失败: {task.result}) else: st.info( 等待处理中...) # 显示任务信息 st.caption(f提示词: {task.prompt[:50]}...) st.caption(f创建时间: {time.ctime(task.created_at)})5. 高级优化技巧5.1 动态批处理优化对于多个相似的生成请求我们可以尝试合并处理def batch_inference_worker(): 批量推理工作线程 model load_model_cached() while True: # 收集一批任务最多4个 batch_tasks [] batch_prompts [] batch_negatives [] # 尝试从队列获取多个任务 for _ in range(4): try: task inference_queue.get_nowait() if task: batch_tasks.append(task) batch_prompts.append(task.prompt) batch_negatives.append(task.negative_prompt) except: break if batch_tasks: try: # 批量推理 with inference_lock: results model( promptbatch_prompts, negative_promptbatch_negatives, num_inference_steps20, guidance_scale2.0, num_images_per_prompt1 ).images # 分配结果 for task, image in zip(batch_tasks, results): task.result image task.status completed # 清理 gc.collect() torch.cuda.empty_cache() except Exception as e: for task in batch_tasks: task.status failed task.result str(e) finally: for task in batch_tasks: inference_queue.task_done() else: # 队列为空稍作等待 time.sleep(0.1)5.2 智能缓存策略根据使用频率动态调整缓存策略from functools import lru_cache import hashlib class SmartModelCache: 智能模型缓存管理器 def __init__(self): self.model_cache {} self.access_count {} def get_model(self, model_key): 获取模型增加访问计数 if model_key in self.model_cache: self.access_count[model_key] self.access_count.get(model_key, 0) 1 # 如果访问频繁保持加载状态 if self.access_count[model_key] 10: return self.model_cache[model_key] # 否则从缓存加载 return self.load_model(model_key) def load_model(self, model_key): 加载模型到缓存 # 如果缓存已满清理最不常用的 if len(self.model_cache) 3: # 最多缓存3个模型 least_used min(self.access_count.items(), keylambda x: x[1])[0] del self.model_cache[least_used] del self.access_count[least_used] # 加载新模型 model self._load_model_by_key(model_key) self.model_cache[model_key] model self.access_count[model_key] 1 return model def _load_model_by_key(self, model_key): 根据key加载特定模型 if model_key z_image_turbo: return load_z_image_turbo() elif model_key z_image_base: return load_z_image_base() # ... 其他模型 lru_cache(maxsize10) def generate_image_hash(self, prompt, negative, steps, cfg): 缓存生成结果的哈希避免重复生成 content f{prompt}|{negative}|{steps}|{cfg} return hashlib.md5(content.encode()).hexdigest()5.3 内存与显存监控添加资源监控防止内存泄漏import psutil import GPUtil def monitor_resources(): 监控系统资源使用情况 # CPU和内存使用 cpu_percent psutil.cpu_percent(interval1) memory psutil.virtual_memory() # GPU显存使用 gpus GPUtil.getGPUs() gpu_info [] for gpu in gpus: gpu_info.append({ name: gpu.name, load: gpu.load * 100, memory_used: gpu.memoryUsed, memory_total: gpu.memoryTotal }) return { cpu_percent: cpu_percent, memory_percent: memory.percent, memory_used_gb: memory.used / (1024**3), gpus: gpu_info } def cleanup_if_needed(threshold0.9): 如果显存使用超过阈值执行清理 gpus GPUtil.getGPUs() for gpu in gpus: memory_ratio gpu.memoryUsed / gpu.memoryTotal if memory_ratio threshold: st.warning(f⚠️ GPU显存使用率过高 ({memory_ratio:.1%})执行清理...) gc.collect() torch.cuda.empty_cache() time.sleep(1) # 等待清理完成 break # 在生成图片前检查资源 def safe_generate(model, **kwargs): 安全的生成函数包含资源检查 cleanup_if_needed(0.85) # 85%阈值 # 监控开始 start_monitor monitor_resources() # 执行生成 result model(**kwargs) # 监控结束 end_monitor monitor_resources() # 记录资源使用变化 memory_increase end_monitor[memory_used_gb] - start_monitor[memory_used_gb] if memory_increase 0.5: # 如果内存增加超过0.5GB st.info(f 本次生成内存使用增加: {memory_increase:.2f} GB) return result6. 完整实现示例让我们把这些优化整合到一个完整的Streamlit应用中import streamlit as st import torch from diffusers import StableDiffusionPipeline import gc import threading from queue import Queue import time from functools import lru_cache # 初始化任务队列和锁 inference_queue Queue() inference_lock threading.Lock() # 缓存模型加载 st.cache_resource def load_cached_model(): 加载并缓存模型管道 st.info( 初始化二次元绘图引擎...) # 加载底座模型 pipe StableDiffusionPipeline.from_pretrained( Tongyi-MAI/Z-Image, torch_dtypetorch.bfloat16, safety_checkerNone, requires_safety_checkerFalse ) # 加载微调权重 st.cache_data def load_weights(): return torch.load(rinaiqiao_huiyewunv.safetensors) weights load_weights() # 适配权重 cleaned_weights {} for k, v in weights.items(): new_key k.replace(transformer., ).replace(model., ) cleaned_weights[new_key] v # 注入权重 pipe.unet.load_state_dict(cleaned_weights, strictFalse) # 优化设置 pipe.enable_model_cpu_offload() # 优化CUDA内存分配 if torch.cuda.is_available(): torch.cuda.set_per_process_memory_fraction(0.9) # 限制显存使用 torch.backends.cudnn.benchmark True # 加速卷积 st.success(✅ 人物模型加载完成) return pipe def inference_worker(): 后台推理工作线程 model load_cached_model() while True: task inference_queue.get() if task is None: break try: task.status processing with inference_lock: # 执行推理 result model( prompttask.prompt, negative_prompttask.negative_prompt, num_inference_stepstask.steps, guidance_scaletask.cfg_scale, width512, height768 ).images[0] task.result result task.status completed # 清理资源 gc.collect() if torch.cuda.is_available(): torch.cuda.empty_cache() torch.cuda.synchronize() except Exception as e: task.status failed task.result f生成失败: {str(e)} finally: inference_queue.task_done() class InferenceTask: def __init__(self, task_id, **kwargs): self.task_id task_id self.prompt kwargs.get(prompt, ) self.negative_prompt kwargs.get(negative_prompt, ) self.steps kwargs.get(steps, 20) self.cfg_scale kwargs.get(cfg_scale, 2.0) self.result None self.status pending self.created_at time.time() def main(): # 页面配置 st.set_page_config( layoutwide, page_title辉夜大小姐专属画师 - 多会话版, page_icon ) # 启动工作线程 if worker_started not in st.session_state: worker_thread threading.Thread(targetinference_worker, daemonTrue) worker_thread.start() st.session_state.worker_started True # 初始化任务管理 if next_task_id not in st.session_state: st.session_state.next_task_id 0 if my_tasks not in st.session_state: st.session_state.my_tasks {} # 侧边栏 - 参数设置 with st.sidebar: st.header( 绘画参数设置) # 提示词 prompt st.text_area( 正面提示词, valuemasterpiece, best quality, 1girl, black hair, red eyes, school uniform, ..., height150, help描述你想要生成的画面 ) # 负面提示词 negative_prompt st.text_area( 负面提示词, valuelow quality, worst quality, bad anatomy, ..., height100, help描述你不希望出现的元素 ) # 生成参数 col1, col2 st.columns(2) with col1: steps st.slider(生成步数, 4, 30, 20, helpTurbo模型推荐20步左右) with col2: cfg_scale st.slider(CFG Scale, 1.0, 5.0, 2.0, 0.5, help提示词约束强度推荐2.0) # 生成按钮 if st.button( 生成人物写真, typeprimary, use_container_widthTrue): # 创建新任务 task_id st.session_state.next_task_id st.session_state.next_task_id 1 task InferenceTask( task_idtask_id, promptprompt, negative_promptnegative_prompt, stepssteps, cfg_scalecfg_scale ) # 保存到会话状态 st.session_state.my_tasks[task_id] task # 添加到队列 inference_queue.put(task) st.toast(f 任务 #{task_id} 已加入队列, icon✅) # 主内容区 st.title( 辉夜大小姐专属画师 - 多会话并发版) st.caption(基于Z-Image Turbo模型支持多用户同时创作) # 两栏布局 col_left, col_right st.columns([1, 2]) with col_left: st.header( 任务状态) # 显示活跃任务数 active_tasks [t for t in st.session_state.my_tasks.values() if t.status in [pending, processing]] st.metric(等待中任务, len(active_tasks)) # 任务列表 for task_id in sorted(st.session_state.my_tasks.keys(), reverseTrue): task st.session_state.my_tasks[task_id] status_icons { pending: ⏳, processing: , completed: ✅, failed: ❌ } with st.expander( f{status_icons.get(task.status, ❓)} 任务 #{task_id} - {task.status}, expandedtask.status ! completed ): # 显示任务信息 st.caption(f提示词: {task.prompt[:60]}...) st.caption(f步数: {task.steps} | CFG: {task.cfg_scale}) st.caption(f创建时间: {time.ctime(task.created_at)}) # 根据状态显示不同内容 if task.status completed and task.result: st.image(task.result, use_column_widthTrue) # 添加下载按钮 st.download_button( label下载图片, datatask.result, file_namefhuiye_{task_id}.png, mimeimage/png, keyfdownload_{task_id} ) elif task.status failed: st.error(task.result) elif task.status processing: st.progress(0.7, text生成中...) else: st.info(排队中请耐心等待...) with col_right: st.header(️ 最新作品) # 显示最新完成的作品 completed_tasks [ t for t in st.session_state.my_tasks.values() if t.status completed and t.result ] if completed_tasks: latest_task completed_tasks[-1] st.image(latest_task.result, use_column_widthTrue) st.caption(f任务 #{latest_task.task_id} - {latest_task.prompt[:80]}...) else: st.info(暂无生成作品点击左侧按钮开始创作吧) # 系统状态信息 st.divider() st.caption( 提示多个用户可以同时使用生成任务会自动排队处理) if __name__ __main__: main()7. 总结通过本文的实践我们成功为Z-Image-Turbo-rinaiqiao-huiyewunv工具添加了Streamlit缓存机制和多会话并发支持。让我们回顾一下关键要点缓存机制的核心价值模型只需加载一次多个会话共享使用大幅减少重复计算提升响应速度有效降低显存占用支持更多并发用户多会话并发的关键实现使用st.cache_resource缓存模型管道通过任务队列管理生成请求使用线程锁避免推理冲突完善的资源监控与清理机制实际效果提升首次加载后后续生成速度提升5-10倍支持5-10个用户同时使用取决于GPU显存系统稳定性显著提高减少内存泄漏问题进一步优化方向实现动态批处理进一步提升吞吐量添加用户身份验证和任务优先级实现生成进度实时反馈添加更多模型参数的自定义选项现在你的Z-Image-Turbo工具已经具备了处理多用户并发访问的能力。无论是个人使用还是小团队协作都能获得流畅稳定的绘图体验。记住良好的缓存策略和并发控制是构建实用AI应用的关键技术点。获取更多AI镜像想探索更多AI镜像和应用场景访问 CSDN星图镜像广场提供丰富的预置镜像覆盖大模型推理、图像生成、视频生成、模型微调等多个领域支持一键部署。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2409736.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

SpringBoot-17-MyBatis动态SQL标签之常用标签

文章目录 1 代码1.1 实体User.java1.2 接口UserMapper.java1.3 映射UserMapper.xml1.3.1 标签if1.3.2 标签if和where1.3.3 标签choose和when和otherwise1.4 UserController.java2 常用动态SQL标签2.1 标签set2.1.1 UserMapper.java2.1.2 UserMapper.xml2.1.3 UserController.ja…

wordpress后台更新后 前端没变化的解决方法

使用siteground主机的wordpress网站,会出现更新了网站内容和修改了php模板文件、js文件、css文件、图片文件后,网站没有变化的情况。 不熟悉siteground主机的新手,遇到这个问题,就很抓狂,明明是哪都没操作错误&#x…

网络编程(Modbus进阶)

思维导图 Modbus RTU(先学一点理论) 概念 Modbus RTU 是工业自动化领域 最广泛应用的串行通信协议,由 Modicon 公司(现施耐德电气)于 1979 年推出。它以 高效率、强健性、易实现的特点成为工业控制系统的通信标准。 包…

UE5 学习系列(二)用户操作界面及介绍

这篇博客是 UE5 学习系列博客的第二篇,在第一篇的基础上展开这篇内容。博客参考的 B 站视频资料和第一篇的链接如下: 【Note】:如果你已经完成安装等操作,可以只执行第一篇博客中 2. 新建一个空白游戏项目 章节操作,重…

IDEA运行Tomcat出现乱码问题解决汇总

最近正值期末周,有很多同学在写期末Java web作业时,运行tomcat出现乱码问题,经过多次解决与研究,我做了如下整理: 原因: IDEA本身编码与tomcat的编码与Windows编码不同导致,Windows 系统控制台…

利用最小二乘法找圆心和半径

#include <iostream> #include <vector> #include <cmath> #include <Eigen/Dense> // 需安装Eigen库用于矩阵运算 // 定义点结构 struct Point { double x, y; Point(double x_, double y_) : x(x_), y(y_) {} }; // 最小二乘法求圆心和半径 …

使用docker在3台服务器上搭建基于redis 6.x的一主两从三台均是哨兵模式

一、环境及版本说明 如果服务器已经安装了docker,则忽略此步骤,如果没有安装,则可以按照一下方式安装: 1. 在线安装(有互联网环境): 请看我这篇文章 传送阵>> 点我查看 2. 离线安装(内网环境):请看我这篇文章 传送阵>> 点我查看 说明&#xff1a;假设每台服务器已…

XML Group端口详解

在XML数据映射过程中&#xff0c;经常需要对数据进行分组聚合操作。例如&#xff0c;当处理包含多个物料明细的XML文件时&#xff0c;可能需要将相同物料号的明细归为一组&#xff0c;或对相同物料号的数量进行求和计算。传统实现方式通常需要编写脚本代码&#xff0c;增加了开…

LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器的上位机配置操作说明

LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器专为工业环境精心打造&#xff0c;完美适配AGV和无人叉车。同时&#xff0c;集成以太网与语音合成技术&#xff0c;为各类高级系统&#xff08;如MES、调度系统、库位管理、立库等&#xff09;提供高效便捷的语音交互体验。 L…

(LeetCode 每日一题) 3442. 奇偶频次间的最大差值 I (哈希、字符串)

题目&#xff1a;3442. 奇偶频次间的最大差值 I 思路 &#xff1a;哈希&#xff0c;时间复杂度0(n)。 用哈希表来记录每个字符串中字符的分布情况&#xff0c;哈希表这里用数组即可实现。 C版本&#xff1a; class Solution { public:int maxDifference(string s) {int a[26]…

【大模型RAG】拍照搜题技术架构速览:三层管道、两级检索、兜底大模型

摘要 拍照搜题系统采用“三层管道&#xff08;多模态 OCR → 语义检索 → 答案渲染&#xff09;、两级检索&#xff08;倒排 BM25 向量 HNSW&#xff09;并以大语言模型兜底”的整体框架&#xff1a; 多模态 OCR 层 将题目图片经过超分、去噪、倾斜校正后&#xff0c;分别用…

【Axure高保真原型】引导弹窗

今天和大家中分享引导弹窗的原型模板&#xff0c;载入页面后&#xff0c;会显示引导弹窗&#xff0c;适用于引导用户使用页面&#xff0c;点击完成后&#xff0c;会显示下一个引导弹窗&#xff0c;直至最后一个引导弹窗完成后进入首页。具体效果可以点击下方视频观看或打开下方…

接口测试中缓存处理策略

在接口测试中&#xff0c;缓存处理策略是一个关键环节&#xff0c;直接影响测试结果的准确性和可靠性。合理的缓存处理策略能够确保测试环境的一致性&#xff0c;避免因缓存数据导致的测试偏差。以下是接口测试中常见的缓存处理策略及其详细说明&#xff1a; 一、缓存处理的核…

龙虎榜——20250610

上证指数放量收阴线&#xff0c;个股多数下跌&#xff0c;盘中受消息影响大幅波动。 深证指数放量收阴线形成顶分型&#xff0c;指数短线有调整的需求&#xff0c;大概需要一两天。 2025年6月10日龙虎榜行业方向分析 1. 金融科技 代表标的&#xff1a;御银股份、雄帝科技 驱动…

观成科技:隐蔽隧道工具Ligolo-ng加密流量分析

1.工具介绍 Ligolo-ng是一款由go编写的高效隧道工具&#xff0c;该工具基于TUN接口实现其功能&#xff0c;利用反向TCP/TLS连接建立一条隐蔽的通信信道&#xff0c;支持使用Let’s Encrypt自动生成证书。Ligolo-ng的通信隐蔽性体现在其支持多种连接方式&#xff0c;适应复杂网…

铭豹扩展坞 USB转网口 突然无法识别解决方法

当 USB 转网口扩展坞在一台笔记本上无法识别,但在其他电脑上正常工作时,问题通常出在笔记本自身或其与扩展坞的兼容性上。以下是系统化的定位思路和排查步骤,帮助你快速找到故障原因: 背景: 一个M-pard(铭豹)扩展坞的网卡突然无法识别了,扩展出来的三个USB接口正常。…

未来机器人的大脑:如何用神经网络模拟器实现更智能的决策?

编辑&#xff1a;陈萍萍的公主一点人工一点智能 未来机器人的大脑&#xff1a;如何用神经网络模拟器实现更智能的决策&#xff1f;RWM通过双自回归机制有效解决了复合误差、部分可观测性和随机动力学等关键挑战&#xff0c;在不依赖领域特定归纳偏见的条件下实现了卓越的预测准…

Linux应用开发之网络套接字编程(实例篇)

服务端与客户端单连接 服务端代码 #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <pthread.h> …

华为云AI开发平台ModelArts

华为云ModelArts&#xff1a;重塑AI开发流程的“智能引擎”与“创新加速器”&#xff01; 在人工智能浪潮席卷全球的2025年&#xff0c;企业拥抱AI的意愿空前高涨&#xff0c;但技术门槛高、流程复杂、资源投入巨大的现实&#xff0c;却让许多创新构想止步于实验室。数据科学家…

深度学习在微纳光子学中的应用

深度学习在微纳光子学中的主要应用方向 深度学习与微纳光子学的结合主要集中在以下几个方向&#xff1a; 逆向设计 通过神经网络快速预测微纳结构的光学响应&#xff0c;替代传统耗时的数值模拟方法。例如设计超表面、光子晶体等结构。 特征提取与优化 从复杂的光学数据中自…