Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $YECBGYFECGEAFWHA as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2

Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $BBWFDDBHHYHDXXAB as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2
如何使用 ghs 运行 llama b bf_创想鸟

如何使用 ghs 运行 llama b bf

lambda 实验室现在推出 gh200 半价优惠,以让更多人习惯 arm 工具。这意味着您实际上可能有能力运行最大的开源模型!唯一需要注意的是,您有时必须从源代码构建一些东西。以下是我如何让 llama 405b 在 gh200s 上高精度运行。

创建实例

llama 405b 约为 750gb,因此您需要大约 10 个 96gb gpu 来运行它。 (gh200 具有相当好的 cpu-gpu 内存交换速度——这就是 gh200 的全部意义——所以你可以使用少至 3 个。每个令牌的时间会很糟糕,但总吞吐量是可以接受的,如果您正在执行批处理。)登录 lambda 实验室并创建一堆 gh200 实例。 确保为它们提供相同的共享网络文件系统。

lambda labs screenshot

将 ip 地址保存到 ~/ips.txt。

批量 ssh 连接助手

我更喜欢直接 bash 和 ssh,而不是 kubernetes 或 slurm 等任何花哨的东西。借助一些助手即可轻松管理。

# skip fingerprint confirmationfor ip in $(cat ~/ips.txt); do    echo "doing $ip"    ssh-keyscan $ip >> ~/.ssh/known_hostsdonefunction run_ip() {    ssh -i ~/.ssh/lambda_id_ed25519 ubuntu@$ip -- stdbuf -ol -el bash -l -c "$(printf "%q" "$*")"  /dev/null}function runall() { ips="$(cat ~/ips.txt)" run_ips "$@"; }function runrest() { ips="$(tail -n+2 ~/ips.txt)" run_ips "$@"; }function ssh_k() {    ip=$(sed -n "$k"p ~/ips.txt)    ssh -i ~/.ssh/lambda_id_ed25519 ubuntu@$ip}alias ssh_head='k=1 ssh_k'function killall() {    pkill -ife '.ssh/lambda_id_ed25519'    sleep 1    pkill -ife -9 '.ssh/lambda_id_ed25519'    while [[ -n "$(jobs -p)" ]]; do fg || true; done}

设置 nfs 缓存

我们将把 python 环境和模型权重放在 nfs 中。如果我们缓存它,加载速度会快得多。

# first, check the nfs works.# runall ln -s my_other_fs_name sharedrunhead 'echo world > shared/hello'runall cat shared/hello# install and enable cachefilesdrunall sudo apt-get updaterunall sudo apt-get install -y cachefilesdrunall "echo 'run=yescache_tag=mycachecache_backend=path=/var/cache/fscachecachefs_reclaim=0' | sudo tee -a /etc/default/cachefilesd"runall sudo systemctl restart cachefilesdrunall 'sudo journalctl -u cachefilesd | tail -n2'# set the "fsc" option on the nfs mountrunhead cat /etc/fstab # should have mount to ~/sharedrunall cp /etc/fstab etc-fstab-bak.txtrunall sudo sed -i 's/,proto=tcp,/,proto=tcp,fsc,/g' /etc/fstabrunall cat /etc/fstab# remountrunall sudo umount /home/ubuntu/wash2runall sudo mount /home/ubuntu/wash2runall cat /proc/fs/nfsfs/volumes # fsc column should say "yes"# test cache speeduprunhead dd if=/dev/urandom of=shared/bigfile bs=1m count=8192runall dd if=shared/bigfile of=/dev/null bs=1m # first one takes 8 secondsrunall dd if=shared/bigfile of=/dev/null bs=1m # seond takes 0.6 seconds

创建conda环境

我们可以在 nfs 中使用 conda 环境,并只用头节点来控制它,而不是在每台机器上小心地执行完全相同的命令。

# we'll also use a shared script instead of changing ~/.profile directly.# easier to fix mistakes that way.runhead 'echo ". /opt/miniconda/etc/profile.d/conda.sh" >> shared/common.sh'runall 'echo "source /home/ubuntu/shared/common.sh" >> ~/.profile'runall which conda# create the environmentrunhead 'conda create --prefix ~/shared/311 -y python=3.11'runhead '~/shared/311/bin/python --version' # double-check that it is executablerunhead 'echo "conda activate ~/shared/311" >> shared/common.sh'runall which python

安装阿芙罗狄蒂依赖项

aphrodite 是 vllm 的一个分支,启动速度更快,并且有一些额外的功能。
它将运行兼容 openai 的推理 api 和模型本身。

你需要手电筒、triton 和闪光注意。
您可以从 pytorch.org 获取 aarch64 torch 构建(您不想自己构建它)。
另外两个你可以自己搭建或者使用我做的轮子。

如果您从源代码构建,那么您可以通过在三台不同的机器上并行运行 triton、flash-attention 和 aphrodite 的 python setup.py bdist_wheel 来节省一些时间。或者您可以在同一台机器上逐一执行它们。

runhead pip install 'numpy<2' torch==2.4.0 --index-url 'https://download.pytorch.org/whl/cu124'# fix for "libstdc++.so.6: version `glibcxx_3.4.30' not found" error:runhead conda install -y -c conda-forge libstdcxx-ng=12runhead python -c 'import torch; print(torch.tensor(2).cuda() + 2, "torch ok")'

来自车轮的 triton 和闪光注意

runhead pip install 'https://github.com/qpwo/lambda-gh200-llama-405b-tutorial/releases/download/v0.1/triton-3.2.0+git755d4164-cp311-cp311-linux_aarch64.whl'runhead pip install 'https://github.com/qpwo/lambda-gh200-llama-405b-tutorial/releases/download/v0.1/aphrodite_flash_attn-2.6.1.post2-cp311-cp311-linux_aarch64.whl'

海卫一从源头

k=1 ssh_k # ssh into first machinepip install -u pip setuptools wheel ninja cmake setuptools_scmgit config --global feature.manyfiles true # faster clonesgit clone https://github.com/triton-lang/triton.git ~/shared/tritoncd ~/shared/triton/pythongit checkout 755d4164 # <-- optional, tested versions# note that ninja already parallelizes everything to the extent possible,# so no sense trying to change the cmake flags or anything.python setup.py bdist_wheelpip install --no-deps dist/*.whl # good idea to download this too for laterpython -c 'import triton; print("triton ok")'

来自源头的闪光注意力

k=2 ssh_k # go into second machinegit clone https://github.com/alpindale/flash-attention  ~/shared/flash-attentioncd ~/shared/flash-attentionpython setup.py bdist_wheelpip install --no-deps dist/*.whlpython -c 'import aphrodite_flash_attn; import aphrodite_flash_attn_2_cuda; print("flash attn ok")'

安装阿芙罗狄蒂

你可以使用我的轮子或自己建造。

轮子上的阿佛洛狄忒

runhead pip install 'https://github.com/qpwo/lambda-gh200-llama-405b-tutorial/releases/download/v0.1/aphrodite_engine-0.6.4.post1-cp311-cp311-linux_aarch64.whl'

阿佛洛狄忒的来源

k=3 ssh_k # building this on the third machinegit clone https://github.com/pygmalionai/aphrodite-engine.git ~/shared/aphrodite-enginecd ~/shared/aphrodite-enginepip install protobuf==3.20.2 ninja msgspec coloredlogs portalocker pytimeparse  -r requirements-common.txtpython setup.py bdist_wheelpip install --no-deps dist/*.whl

检查所有安装是否成功

function runallpyc() { runall "python -c $(printf %q "$*")"; }runallpyc 'import torch; print(torch.tensor(5).cuda() + 1, "torch ok")'runallpyc 'import triton; print("triton ok")'runallpyc 'import aphrodite_flash_attn; import aphrodite_flash_attn_2_cuda; print("flash attn ok")'runallpyc 'import aphrodite; print("aphrodite ok")'runall 'aphrodite run --help | head -n1'

下载权重

转到https://huggingface.co/meta-llama/llama-3.1-405b-instruct并确保您拥有正确的权限。批准通常需要大约一个小时。从https://huggingface.co/settings/tokens
获取令牌

pip install hf_transfer 'huggingface_hub[hf_transfer]'runall git config --global credential.helper storerunall huggingface-cli login --token $new_hf# this tells the huggingface-cli to use the fancy beta downloaderrunhead "echo 'export hf_hub_enable_hf_transfer=1' >> ~/shared/common.sh"runall 'echo $hf_hub_enable_hf_transfer'runall pkill -ife huggingface-cli # kill any stragglers# we can speed up the model download by having each server download partlocal_dir=/home/ubuntu/shared/hff/405b-instructk=1 run_k huggingface-cli download --max-workers=32 --revision="main" --include="model-000[0-4]?-of-00191.safetensors" --local-dir=$local_dir meta-llama/meta-llama-3.1-405b-instruct &k=2 run_k huggingface-cli download --max-workers=32 --revision="main"  --include="model-000[5-9]?-of-00191.safetensors" --local-dir=$local_dir meta-llama/meta-llama-3.1-405b-instruct &k=3 run_k huggingface-cli download --max-workers=32 --revision="main"  --include="model-001[0-4]?-of-00191.safetensors" --local-dir=$local_dir meta-llama/meta-llama-3.1-405b-instruct &k=4 run_k huggingface-cli download --max-workers=32 --revision="main"  --include="model-001[5-9]?-of-00191.safetensors" --local-dir=$local_dir meta-llama/meta-llama-3.1-405b-instruct &wait# download misc remaining filesk=1 run_k huggingface-cli download --max-workers=32 --revision="main" --exclude='*.pth' --local-dir=$local_dir meta-llama/meta-llama-3.1-405b-instruct

奔跑骆驼 405b

我们将通过启动 ray 让服务器相互了解。

runhead pip install -u "ray[data,train,tune,serve]"runall which ray# runall ray stoprunhead ray start --head --disable-usage-stats # note the ip and port ray provides# you can also get the private ip of a node with this command:# ip addr show | grep 'inet ' | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 | head -n 1runrest ray start --address=?.?.?.?:6379runhead ray status # should see 0.0/10.0 gpu (or however many you set up)

我们可以在一个终端选项卡中启动阿芙罗狄蒂:

# ray provides a dashboard (similar to nvidia-smi) at http://localhost:8265# 2242 has the aphrodite api.ssh -l 8265:localhost:8265 -l 2242:localhost:2242 ubuntu@$(head -n1 ~/ips.txt)aphrodite run ~/shared/hff/405b-instruct --served-model-name=405b-instruct --uvloop --distributed-executor-backend=ray -tp 5 -pp 2 --max-num-seqs=128 --max-model-len=2000# it takes a few minutes to start.# it's ready when it prints "chat api: http://localhost:2242/v1/chat/completions"

并在第二个终端中从本地计算机运行查询:

pip install openaipython -c 'import timefrom openai import openaiclient = openai(api_key="empty", base_url="http://localhost:2242/v1")started = time.time()num_tok = 0for part in client.completions.create(    model="405b-instruct",    prompt="live free or die. that is",    temperature=0.7,    n=1,    max_tokens=200,    stream=true,):    text = part.choices[0].text or ""    print(text, end="", flush=true)    num_tok += 1elapsed = time.time() - startedprint()print(f"{num_tok=} {elapsed=:.2} tokens_per_sec={num_tok / elapsed:.1f}")'
 THE LIFE FOR ME."My mother had a similar experience, but it was with a large, angry bee and not a butterfly. She was also in her early twenties, but she was in a car and it was in the middle of a busy highway. She tried to escape the bee's angry buzzing but ended up causing a huge road accident that caused the highway to be closed for several hours. Her face got severely damaged, her eyes were almost destroyed and she had to undergo multiple surgeries to fix the damage. Her face never looked the same after the incident. She was lucky to have survived such a traumatic experience.The big difference between my mother's incident and your father's is that my mother's incident was caused by a bad experience with a bee, while your father's was a good experience with a butterfly. His experience sounds very beautiful and peaceful, while my mother's experience was terrifying and life-alemyI think you have a great point, though, that experiences in our lives shape whonum_tok=200 elapsed=3.8e+01 tokens_per_sec=5.2

对于文本来说速度不错,但是对于代码来说有点慢。如果您连接 2 台 8xh100 服务器,那么每秒会接近 16 个令牌,但成本是原来的三倍。

进一步阅读

理论上,您可以使用 lambda labs api 编写实例创建和销毁脚本https://cloud.lambdalabs.com/api/v1/docs阿佛洛狄忒文档https://aphrodite.pygmalion.chat/vllm 文档(api 大部分相同)https://docs.vllm.ai/en/latest/

以上就是如何使用 ghs 运行 llama b bf的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1354990.html

赞 (0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2025年12月13日 18:57:20
如何构建口罩检测系统:初学者实用指南
下一篇 2025年12月13日 18:57:39

相关推荐

  • 每个 Linux 用户都应该知道的 5 个简单的 Bash 历史技巧

    每个 Linux 用户都应该知道的 5 个简单的 Bash 历史技巧每个 Linux 用户都应该知道的 5 个简单的 Bash 历史技巧每个 Linux 用户都应该知道的 5 个简单的 Bash 历史技巧每个 Linux 用户都应该知道的 5 个简单的 Bash 历史技巧

    无论您是bash 初学者还是专家,如果不使用超级有用的 bash 历史记录功能,您将无法继续在命令行中工作。 您可能已经知道,如果您在 Linux 终端中使用向上或向下箭头键,您可以查看之前运行的命令。 这要归功于bash history 命令。 1.查看您的 bash 历史记录 查看您之前键入的命…

    2026年9月22日 • 用户投稿
    000
  • MySQL备份压缩与加密技巧_MySQL提升备份安全与效率

    MySQL备份压缩与加密技巧_MySQL提升备份安全与效率MySQL备份压缩与加密技巧_MySQL提升备份安全与效率MySQL备份压缩与加密技巧_MySQL提升备份安全与效率MySQL备份压缩与加密技巧_MySQL提升备份安全与效率

    mysql备份压缩与加密的核心在于减少存储空间并提升数据安全性。1. 压缩能显著降低存储成本,提升传输效率,加快恢复速度,简化备份管理,并有助于满足合规要求;2. 加密则通过防止未授权访问保障数据安全。实现方式主要有:1. 使用mysqldump结合gzip和gpg/openssl进行逻辑备份、压缩…

    2026年9月22日 • 用户投稿
    100
  • VS Code中Dockerized PHP项目:解决PHP版本冲突的教程

    本教程旨在解决在VS Code中开发Dockerized PHP项目时,VS Code默认识别宿主机PHP版本而非容器内PHP版本的问题。核心解决方案是利用VS Code的Remote – Containers扩展,实现直接在Docker容器内部进行代码开发,从而确保VS Code及其所…

    2026年9月22日
    200
  • 蔡司2亿影像大小王,年度影像旗舰vivo X300系列发布!

    蔡司2亿影像大小王,年度影像旗舰vivo X300系列发布!蔡司2亿影像大小王,年度影像旗舰vivo X300系列发布!蔡司2亿影像大小王,年度影像旗舰vivo X300系列发布!蔡司2亿影像大小王,年度影像旗舰vivo X300系列发布!

    PConline最新资讯,vivo于今晚正式揭晓X300系列新机,定位“全焦段影像旗舰”,起售价为4399元。该系列成为首款搭载联发科天玑9500芯片的智能手机,并携手三星与索尼共同定制多颗影像传感器,在影像能力、屏幕素质及续航表现上力求全面跃升。 产品线涵盖X300与X300 Pro两款机型,价格…

    2026年9月22日 • 用户投稿
    000
  • 从AI场景搭建到蝴蝶号运营,全流程实战攻略

    从AI场景搭建到蝴蝶号运营,全流程实战攻略从AI场景搭建到蝴蝶号运营,全流程实战攻略从AI场景搭建到蝴蝶号运营,全流程实战攻略从AI场景搭建到蝴蝶号运营,全流程实战攻略

    做ai内容变现需先明确方向再选工具,注册蝴蝶号要模拟真实行为,用ai提升效率但需调整内容细节,流量转化重于播放量。一、先确定内容类型和风格,根据方向选择合适ai工具链搭建流程,用免费api测试效果。二、蝴蝶号注册尽量用企业主体,资料完整,养号阶段关注同类账号,保持每天发布1~2条内容,视频控制在30…

    2026年9月22日 • 用户投稿
    100
  • GIMP中如何利用AI裁剪图片?一步步完成高效图像裁剪方法

    GIMP虽无“一键AI裁剪”功能,但可通过智能选择工具(如前景选择、智能剪刀)精准选中主体,结合Resynthesizer插件的内容感知填充实现类AI裁剪效果;对于更高要求,可协同Remove.bg等外部AI工具完成自动抠图,再导入GIMP进行裁剪或背景替换,形成高效智能裁剪工作流。 ☞☞☞AI 智…

    2026年9月22日
    100
  • MySQL字段映射表自动生成方案_Sublime一键导出JSON与结构化模板

    MySQL字段映射表自动生成方案_Sublime一键导出JSON与结构化模板MySQL字段映射表自动生成方案_Sublime一键导出JSON与结构化模板MySQL字段映射表自动生成方案_Sublime一键导出JSON与结构化模板MySQL字段映射表自动生成方案_Sublime一键导出JSON与结构化模板

    如何利用sublime text插件提升mysql字段映射表生成效率?1. 插件通过自动化提取sql语句中的表结构信息,减少手动操作;2. 支持一键导出为json或结构化模板(如markdown、html表格),提升开发效率;3. 利用sublime text的python插件机制,实现快速集成与执…

    2026年9月22日 • 用户投稿
    000
  • 疑似荣耀500系列入网 代号Merry全系支持80W有线快充

    10月25日,知名数码博主“数码闲聊站”透露,荣耀500系列新机已现身工信部,型号分别为mep-an00和mey-an00,预计代号为merry/merryp,全系支持80w有线快充。该博主还表示,此前上手的样机提供了黑色、银色、粉色和蓝色等多种配色方案,外观设计或将延续前代爆款风格。 据最新消息,…

    2026年9月22日
    000
  • VSCode搭建Python开发环境(附详细截图,小白也能学会)

    答案:搭建VSCode Python环境需安装Python并添加至PATH,安装VSCode及Python扩展,创建项目文件并选择正确解释器,通过虚拟环境隔离依赖,利用Pylance、Black、Flake8等工具提升开发效率,常见问题多为路径或环境配置错误,可通过检查解释器选择和安装路径解决。 在…

    2026年9月22日
    100
  • Vision Transformer 必读系列之图像分类综述(三): MLP、ConvMixer 和架构分析

    Vision Transformer 必读系列之图像分类综述(三): MLP、ConvMixer 和架构分析Vision Transformer 必读系列之图像分类综述(三): MLP、ConvMixer 和架构分析Vision Transformer 必读系列之图像分类综述(三): MLP、ConvMixer 和架构分析Vision Transformer 必读系列之图像分类综述(三): MLP、ConvMixer 和架构分析

    号外号外!awesome-vit 上新啦, 欢迎大家 Star Star Star ~ https://github.com/open-mmlab/awesome-vit 前言 在 Vision Transformer 必读系列之图像分类综述(一):概述 一文中对 Vision Transforme…

    2026年9月22日 • 用户投稿
    200
  • 蝴蝶号无人直播完整流程详解:搭建+开播+引流

    蝴蝶号无人直播完整流程详解:搭建+开播+引流蝴蝶号无人直播完整流程详解:搭建+开播+引流蝴蝶号无人直播完整流程详解:搭建+开播+引流蝴蝶号无人直播完整流程详解:搭建+开播+引流

    蝴蝶号无人直播的完整流程包括前期准备、直播搭建、开播设置、引流推广、监控与维护五个步骤。前期准备需完成账号注册认证、硬件设备配置、软件安装及素材准备;直播搭建涉及场景设置、素材导入、循环播放设定及自动化脚本配置;开播设置包括直播间信息填写、推流配置与测试直播;引流推广可通过平台内工具、社交媒体、内容…

    2026年9月22日 • 用户投稿
    100
  • 如何在VEED.io中制作AI视频?在线工具快速剪辑AI内容的步骤

    如何在VEED.io中制作AI视频?在线工具快速剪辑AI内容的步骤如何在VEED.io中制作AI视频?在线工具快速剪辑AI内容的步骤如何在VEED.io中制作AI视频?在线工具快速剪辑AI内容的步骤如何在VEED.io中制作AI视频?在线工具快速剪辑AI内容的步骤

    VEED.io通过“文本转视频”和“AI形象”功能,让视频制作变得简单高效。用户只需输入文本,即可生成带AI配音、字幕和匹配素材的视频,或选择AI虚拟人物进行口型同步播报。平台还提供AI语音合成、自动字幕、多语言支持及丰富编辑功能,便于后期精修。优化效果需从高质量文本入手,合理选择声音与形象,并通过…

    2026年9月22日 • 用户投稿
    000
  • Java中递归处理列表:条件性移除最大值策略与实现

    本教程深入探讨了如何在Java中使用递归方法,根据特定条件(如列表是否已排序、最大值是否位于列表的首尾)来移除列表中的最大值。文章将详细阐述如何设计一个高效的递归算法,包括排序检查、最大值定位以及条件性移除的实现细节,并提供完整的代码示例和注意事项,帮助读者掌握递归在复杂列表操作中的应用。 引言:递…

    2026年9月22日
    000
  • 玩转 Spring Boot 集成篇(定时任务框架Quartz)

    玩转 Spring Boot 集成篇(定时任务框架Quartz)玩转 Spring Boot 集成篇(定时任务框架Quartz)玩转 Spring Boot 集成篇(定时任务框架Quartz)玩转 Spring Boot 集成篇(定时任务框架Quartz)

    在日常项目研发中,定时任务可谓是必不可少的一环,关于 spring boot 如何实现静态定时任务、动态定时任务以及如何开启多线程跑任务,均已在上篇分享过,不再赘述。 虽然 Spring Boot 内置注解方式实现的定时任务,在一定程度上也能解决一定的业务场景问题,但是若做更复杂的动作,例如启停任务…

    2026年9月22日 • 用户投稿
    100
  • Cortana如何连接邮箱_Cortana邮箱同步配置方法

    首先需将邮箱账户与Cortana连接,可通过Windows设置添加账户或在Cortana应用内手动配置,支持Outlook.com、Gmail及Exchange等类型;完成账户添加后,须在隐私权限中启用邮件读取和同步权限,确保Cortana可访问邮件、日历及联系人数据,从而实现智能提醒与信息同步功能…

    2026年9月22日
    000
  • 如何用Sublime导出MySQL数据表结构_生成Markdown或HTML格式文档

    要使用 sublime text 导出 mysql 数据表结构并生成 markdown 或 html 文档,需通过以下步骤操作:1. 使用 show create table 命令或 mysqldump 工具获取建表语句;2. 在 sublime 中整理字段信息,按字段名、类型、是否为空、键、默认值…

    2026年9月22日
    000
  • 三角洲行动S6九格保险任务速通指南

    三角洲行动S6九格保险任务速通指南三角洲行动S6九格保险任务速通指南三角洲行动S6九格保险任务速通指南三角洲行动S6九格保险任务速通指南

    在《三角洲行动》s6赛季中,九格保险任务成了不少玩家头疼的难题,耗时久、节奏慢,稍不注意就被卡住。其实只要掌握策略,合理安排任务顺序,高效推进并非难事!接下来这份分阶段速通攻略,将帮你理清思路,快速通关九格保险任务! 三角洲行动S6赛季九格保险任务高效速通指南 第一阶段:聚焦主线与关键前置 优先完成…

    2026年9月22日 • 用户投稿
    100
  • 解决PHP应用中本地文件更新后网页视图不刷新的缓存问题

    本文探讨了PHP应用中,本地JSON或图片文件更新后,网页视图无法实时刷新的常见问题。核心原因在于浏览器缓存机制。文章将提供多种解决方案,包括强制刷新、隐身模式诊断、以及通过URL参数、服务器配置(.htaccess)和文件版本控制来有效管理缓存,确保用户始终获取最新数据。 理解问题:本地文件更新与…

    2026年9月22日
    200
  • VSCode如何安装和使用插件 VSCode插件管理的高效方法

    安装插件需通过vscode扩展视图搜索并点击安装,部分插件需重启或配置后生效;2. 使用插件时可通过命令面板、上下文菜单、状态栏或自动语言特性调用功能,并在设置中自定义行为;3. 高效管理应定期审视插件使用频率,禁用或卸载不常用者,关注性能影响,利用“开发者: 显示正在运行的扩展”识别资源占用高的插…

    2026年9月22日
    200
  • Java Stream API:从嵌套集合中提取唯一值的高效实践

    本文深入探讨如何利用Java Stream API,从包含嵌套集合的对象列表中高效地提取唯一的字符串值。我们将重点介绍flatMap()和mapMulti()这两种强大的流操作,演示它们如何替代传统的嵌套循环,从而实现代码的简洁性、可读性以及潜在的性能优化。 在java应用开发中,我们经常会遇到处理…

    2026年9月22日
    100

发表回复

登录后才能评论
关注微信