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

快速方便地下载huggingface的模型库和数据集

快速方便地下载huggingface的模型库和数据集

  • 方法一:用于使用 aria2/wget+git 下载 Huggingface 模型和数据集的 CLI 工具
    • 特点
    • Usage
  • 方法二:模型下载【个人使用记录】
    • 保持目录结构
    • 数据集下载
    • 不足之处

方法一:用于使用 aria2/wget+git 下载 Huggingface 模型和数据集的 CLI 工具

来自https://gist.github.com/padeoe/697678ab8e528b85a2a7bddafea1fa4f。

使用方法:将hfd.sh拷贝过去,然后参考下面的参考命令,下载数据集或者模型

🤗Huggingface 模型下载器

考虑到官方 huggingface-cli 缺乏多线程下载支持,以及错误处理不足在 hf_transfer 中,这个命令行工具巧妙地利用 wgetaria2 来处理 LFS 文件,并使用 git clone 来处理其余文件。

特点

  • ⏯️ 从断点恢复:您可以随时重新运行它或按 Ctrl+C。
  • 🚀 多线程下载:利用多线程加速下载过程。
  • 🚫 文件排除:使用--exclude--include跳过或指定文件,为具有重复格式的模型(例如,*.bin*.safetensors)节省时间)。
  • 🔐 身份验证支持:对于需要 Huggingface 登录的门控模型,请使用 --hf_username--hf_token 进行身份验证。
  • 🪞 镜像站点支持:使用“HF_ENDPOINT”环境变量进行设置。
  • 🌍代理支持:使用“HTTPS_PROXY”环境变量进行设置。
  • 📦 简单:仅依赖gitaria2c/wget

Usage

首先,下载 hfd.sh 或克隆此存储库,然后授予脚本执行权限。

chmod a+x hfd.sh

为了方便起见,您可以创建一个别名

alias hfd="$PWD/hfd.sh"

使用说明:

$ ./hfd.sh -h
Usage:hfd <repo_id> [--include include_pattern] [--exclude exclude_pattern] [--hf_username username] [--hf_token token] [--tool aria2c|wget] [-x threads] [--dataset] [--local-dir path]Description:Downloads a model or dataset from Hugging Face using the provided repo ID.Parameters:repo_id        The Hugging Face repo ID in the format 'org/repo_name'.--include       (Optional) Flag to specify a string pattern to include files for downloading.--exclude       (Optional) Flag to specify a string pattern to exclude files from downloading.include/exclude_pattern The pattern to match against filenames, supports wildcard characters. e.g., '--exclude *.safetensor', '--include vae/*'.--hf_username   (Optional) Hugging Face username for authentication. **NOT EMAIL**.--hf_token      (Optional) Hugging Face token for authentication.--tool          (Optional) Download tool to use. Can be aria2c (default) or wget.-x              (Optional) Number of download threads for aria2c. Defaults to 4.--dataset       (Optional) Flag to indicate downloading a dataset.--local-dir     (Optional) Local directory path where the model or dataset will be stored.Example:hfd bigscience/bloom-560m --exclude *.safetensorshfd meta-llama/Llama-2-7b --hf_username myuser --hf_token mytoken -x 4hfd lavita/medical-qa-shared-task-v1-toy --dataset

下载模型:

hfd bigscience/bloom-560m

下载模型需要登录

从https://huggingface.co/settings/tokens获取huggingface令牌,然后

hfd meta-llama/Llama-2-7b --hf_username YOUR_HF_USERNAME_NOT_EMAIL --hf_token YOUR_HF_TOKEN

下载模型并排除某些文件(例如.safetensors):

hfd bigscience/bloom-560m --exclude *.safetensors

使用 aria2c 和多线程下载:

hfd bigscience/bloom-560m

输出
下载过程中,将显示文件 URL:

$ hfd bigscience/bloom-560m --tool wget --exclude *.safetensors
...
Start Downloading lfs files, bash script:wget -c https://huggingface.co/bigscience/bloom-560m/resolve/main/flax_model.msgpack
# wget -c https://huggingface.co/bigscience/bloom-560m/resolve/main/model.safetensors
wget -c https://huggingface.co/bigscience/bloom-560m/resolve/main/onnx/decoder_model.onnx
...
# 安装包
apt update
apt-get install aria2
apt-get install iftop
apt-get install git-lfs 
#参考命令
bash /xxx/xxx/hfd.sh mmaaz60/ActivityNet-QA-Test-Videos --tool aria2c -x 16 --dataset --local-dir /xxx/xxx/ActivityNet

hfd.sh

#!/usr/bin/env bash
# Color definitions
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Colortrap 'printf "${YELLOW}\nDownload interrupted. If you re-run the command, you can resume the download from the breakpoint.\n${NC}"; exit 1' INTdisplay_help() {cat << EOF
Usage:hfd <repo_id> [--include include_pattern] [--exclude exclude_pattern] [--hf_username username] [--hf_token token] [--tool aria2c|wget] [-x threads] [--dataset] [--local-dir path]    Description:Downloads a model or dataset from Hugging Face using the provided repo ID.Parameters:repo_id        The Hugging Face repo ID in the format 'org/repo_name'.--include       (Optional) Flag to specify a string pattern to include files for downloading.--exclude       (Optional) Flag to specify a string pattern to exclude files from downloading.include/exclude_pattern The pattern to match against filenames, supports wildcard characters. e.g., '--exclude *.safetensor', '--include vae/*'.--hf_username   (Optional) Hugging Face username for authentication. **NOT EMAIL**.--hf_token      (Optional) Hugging Face token for authentication.--tool          (Optional) Download tool to use. Can be aria2c (default) or wget.-x              (Optional) Number of download threads for aria2c. Defaults to 4.--dataset       (Optional) Flag to indicate downloading a dataset.--local-dir     (Optional) Local directory path where the model or dataset will be stored.Example:hfd bigscience/bloom-560m --exclude *.safetensorshfd meta-llama/Llama-2-7b --hf_username myuser --hf_token mytoken -x 4hfd lavita/medical-qa-shared-task-v1-toy --dataset
EOFexit 1
}MODEL_ID=$1
shift# Default values
TOOL="aria2c"
THREADS=4
HF_ENDPOINT=${HF_ENDPOINT:-"https://hf-mirror.com"}while [[ $# -gt 0 ]]; docase $1 in--include) INCLUDE_PATTERN="$2"; shift 2 ;;--exclude) EXCLUDE_PATTERN="$2"; shift 2 ;;--hf_username) HF_USERNAME="$2"; shift 2 ;;--hf_token) HF_TOKEN="$2"; shift 2 ;;--tool) TOOL="$2"; shift 2 ;;-x) THREADS="$2"; shift 2 ;;--dataset) DATASET=1; shift ;;--local-dir) LOCAL_DIR="$2"; shift 2 ;;*) shift ;;esac
done# Check if aria2, wget, curl, git, and git-lfs are installed
check_command() {if ! command -v $1 &>/dev/null; thenecho -e "${RED}$1 is not installed. Please install it first.${NC}"exit 1fi
}# Mark current repo safe when using shared file system like samba or nfs
ensure_ownership() {if git status 2>&1 | grep "fatal: detected dubious ownership in repository at" > /dev/null; thengit config --global --add safe.directory "${PWD}"printf "${YELLOW}Detected dubious ownership in repository, mark ${PWD} safe using git, edit ~/.gitconfig if you want to reverse this.\n${NC}" fi
}[[ "$TOOL" == "aria2c" ]] && check_command aria2c
[[ "$TOOL" == "wget" ]] && check_command wget
check_command curl; check_command git; check_command git-lfs[[ -z "$MODEL_ID" || "$MODEL_ID" =~ ^-h ]] && display_helpif [[ -z "$LOCAL_DIR" ]]; thenLOCAL_DIR="${MODEL_ID#*/}"
fiif [[ "$DATASET" == 1 ]]; thenMODEL_ID="datasets/$MODEL_ID"
fi
echo "Downloading to $LOCAL_DIR"if [ -d "$LOCAL_DIR/.git" ]; thenprintf "${YELLOW}%s exists, Skip Clone.\n${NC}" "$LOCAL_DIR"cd "$LOCAL_DIR" && ensure_ownership && GIT_LFS_SKIP_SMUDGE=1 git pull || { printf "${RED}Git pull failed.${NC}\n"; exit 1; }
elseREPO_URL="$HF_ENDPOINT/$MODEL_ID"GIT_REFS_URL="${REPO_URL}/info/refs?service=git-upload-pack"echo "Testing GIT_REFS_URL: $GIT_REFS_URL"response=$(curl -s -o /dev/null -w "%{http_code}" "$GIT_REFS_URL")if [ "$response" == "401" ] || [ "$response" == "403" ]; thenif [[ -z "$HF_USERNAME" || -z "$HF_TOKEN" ]]; thenprintf "${RED}HTTP Status Code: $response.\nThe repository requires authentication, but --hf_username and --hf_token is not passed. Please get token from https://huggingface.co/settings/tokens.\nExiting.\n${NC}"exit 1fiREPO_URL="https://$HF_USERNAME:$HF_TOKEN@${HF_ENDPOINT#https://}/$MODEL_ID"elif [ "$response" != "200" ]; thenprintf "${RED}Unexpected HTTP Status Code: $response\n${NC}"printf "${YELLOW}Executing debug command: curl -v %s\nOutput:${NC}\n" "$GIT_REFS_URL"curl -v "$GIT_REFS_URL"; printf "\n${RED}Git clone failed.\n${NC}"; exit 1fiecho "GIT_LFS_SKIP_SMUDGE=1 git clone $REPO_URL $LOCAL_DIR"GIT_LFS_SKIP_SMUDGE=1 git clone $REPO_URL $LOCAL_DIR && cd "$LOCAL_DIR" || { printf "${RED}Git clone failed.\n${NC}"; exit 1; }ensure_ownershipwhile IFS= read -r file; dotruncate -s 0 "$file"done <<< $(git lfs ls-files | cut -d ' ' -f 3-)
fiprintf "\nStart Downloading lfs files, bash script:\ncd $LOCAL_DIR\n"
files=$(git lfs ls-files | cut -d ' ' -f 3-)
declare -a urlswhile IFS= read -r file; dourl="$HF_ENDPOINT/$MODEL_ID/resolve/main/$file"file_dir=$(dirname "$file")mkdir -p "$file_dir"if [[ "$TOOL" == "wget" ]]; thendownload_cmd="wget -c \"$url\" -O \"$file\""[[ -n "$HF_TOKEN" ]] && download_cmd="wget --header=\"Authorization: Bearer ${HF_TOKEN}\" -c \"$url\" -O \"$file\""elsedownload_cmd="aria2c --console-log-level=error --file-allocation=none -x $THREADS -s $THREADS -k 1M -c \"$url\" -d \"$file_dir\" -o \"$(basename "$file")\""[[ -n "$HF_TOKEN" ]] && download_cmd="aria2c --header=\"Authorization: Bearer ${HF_TOKEN}\" --console-log-level=error --file-allocation=none -x $THREADS -s $THREADS -k 1M -c \"$url\" -d \"$file_dir\" -o \"$(basename "$file")\""fi[[ -n "$INCLUDE_PATTERN" && ! "$file" == $INCLUDE_PATTERN ]] && printf "# %s\n" "$download_cmd" && continue[[ -n "$EXCLUDE_PATTERN" && "$file" == $EXCLUDE_PATTERN ]] && printf "# %s\n" "$download_cmd" && continueprintf "%s\n" "$download_cmd"urls+=("$url|$file")
done <<< "$files"for url_file in "${urls[@]}"; doIFS='|' read -r url file <<< "$url_file"printf "${YELLOW}Start downloading ${file}.\n${NC}" file_dir=$(dirname "$file")if [[ "$TOOL" == "wget" ]]; then[[ -n "$HF_TOKEN" ]] && wget --header="Authorization: Bearer ${HF_TOKEN}" -c "$url" -O "$file" || wget -c "$url" -O "$file"else[[ -n "$HF_TOKEN" ]] && aria2c --header="Authorization: Bearer ${HF_TOKEN}" --console-log-level=error --file-allocation=none -x $THREADS -s $THREADS -k 1M -c "$url" -d "$file_dir" -o "$(basename "$file")" || aria2c --console-log-level=error --file-allocation=none -x $THREADS -s $THREADS -k 1M -c "$url" -d "$file_dir" -o "$(basename "$file")"fi[[ $? -eq 0 ]] && printf "Downloaded %s successfully.\n" "$url" || { printf "${RED}Failed to download %s.\n${NC}" "$url"; exit 1; }
doneprintf "${GREEN}Download completed successfully.\n${NC}"

方法二:模型下载【个人使用记录】

这个代码不能保持目录结构,见下面的改进版

import datetime
import os
import threadingfrom huggingface_hub import hf_hub_url
from huggingface_hub.hf_api import HfApi
from huggingface_hub.utils import filter_repo_objects# 执行命令
def execCmd(cmd):print("命令%s开始运行%s" % (cmd, datetime.datetime.now()))os.system(cmd)print("命令%s结束运行%s" % (cmd, datetime.datetime.now()))if __name__ == '__main__':# 需下载的hf库名称repo_id = "Salesforce/blip2-opt-2.7b"# 本地存储路径save_path = './blip2-opt-2.7b'# 获取项目信息_api = HfApi()repo_info = _api.repo_info(repo_id=repo_id,repo_type="model",revision='main',token=None,)# 获取文件信息filtered_repo_files = list(filter_repo_objects(items=[f.rfilename for f in repo_info.siblings],allow_patterns=None,ignore_patterns=None,))cmds = []threads = []# 需要执行的命令列表for file in filtered_repo_files:# 获取路径url = hf_hub_url(repo_id=repo_id, filename=file)# 断点下载指令cmds.append(f'wget -c {url} -P {save_path}')print(cmds)print("程序开始%s" % datetime.datetime.now())for cmd in cmds:th = threading.Thread(target=execCmd, args=(cmd,))th.start()threads.append(th)for th in threads:th.join()print("程序结束%s" % datetime.datetime.now())

保持目录结构

import datetime
import os
import threading
from pathlib import Pathfrom huggingface_hub import hf_hub_url
from huggingface_hub.hf_api import HfApi
from huggingface_hub.utils import filter_repo_objects# 执行命令
def execCmd(cmd):print("命令%s开始运行%s" % (cmd, datetime.datetime.now()))os.system(cmd)print("命令%s结束运行%s" % (cmd, datetime.datetime.now()))if __name__ == '__main__':# 需下载的hf库名称repo_id = "Salesforce/blip2-opt-2.7b"# 本地存储路径save_path = './blip2-opt-2.7b'# 创建本地保存目录Path(save_path).mkdir(parents=True, exist_ok=True)# 获取项目信息_api = HfApi()repo_info = _api.repo_info(repo_id=repo_id,repo_type="model",revision='main',token=None,)# 获取文件信息filtered_repo_files = list(filter_repo_objects(items=[f.rfilename for f in repo_info.siblings],allow_patterns=None,ignore_patterns=None,))cmds = []threads = []# 需要执行的命令列表for file in filtered_repo_files:# 获取路径url = hf_hub_url(repo_id=repo_id, filename=file)# 在本地创建子目录local_file = os.path.join(save_path, file)local_dir = os.path.dirname(local_file)Path(local_dir).mkdir(parents=True, exist_ok=True)# 断点下载指令cmds.append(f'wget -c {url} -P {local_dir}')print(cmds)print("程序开始%s" % datetime.datetime.now())for cmd in cmds:th = threading.Thread(target=execCmd, args=(cmd,))th.start()threads.append(th)for th in threads:th.join()print("程序结束%s" % datetime.datetime.now())

数据集下载

import datetime
import os
import threading
from pathlib import Pathfrom huggingface_hub import HfApi
from huggingface_hub.utils import filter_repo_objects# 执行命令
def execCmd(cmd):print("命令%s开始运行%s" % (cmd, datetime.datetime.now()))os.system(cmd)print("命令%s结束运行%s" % (cmd, datetime.datetime.now()))if __name__ == '__main__':# 需下载的数据集IDdataset_id = "openai/webtext"# 本地存储路径save_path = './webtext'# 创建本地保存目录Path(save_path).mkdir(parents=True, exist_ok=True)# 获取数据集信息_api = HfApi()dataset_info = _api.dataset_info(dataset_id=dataset_id,revision='main',token=None,)# 获取文件信息filtered_dataset_files = list(filter_repo_objects(items=[f.rfilename for f in dataset_info.siblings],allow_patterns=None,ignore_patterns=None,))cmds = []threads = []# 需要执行的命令列表for file in filtered_dataset_files:# 获取路径url = dataset_info.get_file_url(file)# 在本地创建子目录local_file = os.path.join(save_path, file)local_dir = os.path.dirname(local_file)Path(local_dir).mkdir(parents=True, exist_ok=True)# 断点下载指令cmds.append(f'wget -c {url} -P {local_dir}')print(cmds)print("程序开始%s" % datetime.datetime.now())for cmd in cmds:th = threading.Thread(target=execCmd, args=(cmd,))th.start()threads.append(th)for th in threads:th.join()print("程序结束%s" % datetime.datetime.now())

不足之处

不支持需要授权的库。

文件太多可能会开很多线程。


创作不易,观众老爷们请留步… 动起可爱的小手,点个赞再走呗 (๑◕ܫ←๑)
欢迎大家关注笔者,你的关注是我持续更博的最大动力


原创文章,转载告知,盗版必究



在这里插入图片描述


在这里插入图片描述
♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠

相关文章:

快速方便地下载huggingface的模型库和数据集

快速方便地下载huggingface的模型库和数据集 方法一&#xff1a;用于使用 aria2/wgetgit 下载 Huggingface 模型和数据集的 CLI 工具特点Usage 方法二&#xff1a;模型下载【个人使用记录】保持目录结构数据集下载不足之处 方法一&#xff1a;用于使用 aria2/wgetgit 下载 Hugg…...

JAVA小白学习日记Day10

1.线程锁 使用Runnable接口和Lambda表达式&#xff1a; 在 EasyThreadA 类的 mainA 方法中&#xff0c;通过创建 Runnable 实例 run&#xff0c;并使用Lambda表达式。 EasyThreadA::method 绑定到 run 上。然后创建两个线程 a 和 b&#xff0c;分别启动它们&#xff0c;它们会…...

分布式相关理论详解

目录 1.绪论 2.什么是分布式系统&#xff0c;和集群的区别 3.CAP理论 3.1 什么是CAP理论 3.2 一致性 3.2.1 计算机的一致性说明 1.事务中的一致性 2.并发场景下的一致性 3.分布式场景下的一致性 3.2.2 一致性分类 3.2.3 强一致性 1.线性一致性 a) 定义 a) Raft算法…...

Linux基础知识之Shell命令行及终端中的快捷键

1.察看历史命令快捷键 按键 操作 ctrl p 返回上一次输入命令字符 ctrl n 返回下一次输入命令字符 ctrl r 输入单词甚至词组搜索匹配历史命令 alt p 输入字符查找与字符相接近的历史命令 alt . 向之前执行的命令的最后一个参数轮循, 并将之添加到当前光标之后…...

研究生选择学习Android开发的利与弊?

在开始前刚好我有一些资料&#xff0c;是我根据网友给的问题精心整理了一份「Android的资料从专业入门到高级教程」&#xff0c; 点个关注在评论区回复“888”之后私信回复“888”&#xff0c;全部无偿共享给大家&#xff01;&#xff01;&#xff01;产品经理可以学学Axure快…...

怎么评价程序员40岁了竟然还在撸代码?

怎么评价外卖员40岁了竟然还在送外卖&#xff1f; 怎么评价滴滴司机40岁了竟然还在跑滴滴&#xff1f; 怎么评价老师40岁了竟然还在教书&#xff1f;难道程序员的本职工作不是敲代码吗&#xff1f;无论你是管理层还是螺丝钉&#xff0c;工业环境下怎么可能一行代码都不敲呢&…...

SQL优化(一)基础概念

基数&#xff08;cardinality&#xff09; 表中某个列的唯一键的数量叫做基数&#xff0c;主键列的基数就是表中数据的总行数。 可以用select count(distinct 列名) from 表名来计算基数。 基数的高低影像列的数据分布。 例如&#xff1a;先用Scott账户创建一个测试表test …...

【C++高阶】哈希:全面剖析与深度学习

目录 &#x1f680; 前言一&#xff1a; &#x1f525; unordered系列关联式容器1.1 unordered_map1.2 unordered_set 二&#xff1a; &#x1f525; 哈希的底层结构 ⭐ 2.1 哈希概念⭐ 2.2 哈希冲突⭐ 2.3 哈希函数⭐ 2.4 哈希冲突解决2.4.1 &#x1f304;闭散列2.4.2 &#x…...

PHP西陆招聘求职系统小程序源码

&#x1f525;【职场新宠】西陆招聘求职系统&#xff0c;你的职场加速器&#x1f680; &#x1f389;【开篇安利&#xff1a;一站式求职新体验】&#x1f389; 还在为找工作焦头烂额吗&#xff1f;是时候告别传统招聘网站的繁琐与低效了&#xff01;今天给大家种草一个超赞的…...

系统移植(十一)根文件系统(未整理)

文章目录 一、根文件系统中各个目录文件功能解析&#xff1a;二、对busybox进行配置和编译&#xff08;一&#xff09;执行make help命令获取make的帮助信息&#xff08;二&#xff09;对busybox源码进行配置&#xff0c;配置交叉编译器&#xff08;三&#xff09;执行make men…...

mac中docker常用命令总结

在Mac中&#xff0c;Docker的常用命令可以总结如下表格&#xff1a; 命令用途docker run运行一个新的容器实例。可以指定镜像名来启动容器&#xff0c;并支持多种参数来调整容器的运行方式。docker ps列出当前正在运行的容器。可以通过添加-a参数来列出所有容器&#xff08;包…...

Python 【机器学习】 进阶 之 【实战案例】房价数据中位数分析 [ 项目介绍 ] [ 获取数据 ] [ 创建测试集 ]| 1/3(含分析过程)

Python 【机器学习】 进阶 之 【实战案例】房价数据中位数分析 [ 项目介绍 ] [ 获取数据 ] [ 创建测试集 ]| 1/3&#xff08;含分析过程&#xff09; 目录 Python 【机器学习】 进阶 之 【实战案例】房价数据中位数分析 [ 项目介绍 ] [ 获取数据 ] [ 创建测试集 ]| 1/3&#x…...

Linux 4: Bash

1 Bash环境 1 命令执行的顺序 1 绝对路径、相对路径 2 alias 3 内置的builtin 4 $PATH找到的第一个命令 2 bash的登录信息&#xff0c;保存在哪里&#xff1f; 保存在/etc/issue. 3 bash的环境配置文件 1 如果是login shell&#xff0c;读以下&#xff0c;有优先级:如果…...

第十四天学习笔记2024.7.25

Git安装 1.安装git 2.创建git仓库 3.创建文件并且提交文件 &#xff08;git add . 将文件提交到缓存&#xff09;&#xff08;git commit -m 说明&#xff09;&#xff08;git log 查看历史&#xff09; 4.分支创建与解决分支冲突问题 创建主机&#xff08;git 192.1…...

花几千上万学习Java,真没必要!(三十七)

IO 流&#xff1a; 读取数据到内存的过程&#xff1a;可以包括从硬盘、网络或其他存储设备中将数据加载到内存中&#xff0c;以便程序能够访问和处理这些数据。 写入数据到硬盘的过程&#xff1a;通常是将内存中的数据保存到硬盘或其他持久性存储设备中&#xff0c;以便长期存…...

SSA-GRU(自适应平滑自回归门控循环单元)预测模型及其Python和MATLAB实现

SSA-GRU&#xff08;自适应平滑自回归门控循环单元&#xff09;预测模型是结合了SSA&#xff08;Singular Spectrum Analysis&#xff0c;奇异谱分析&#xff09;和GRU&#xff08;Gated Recurrent Unit&#xff0c;门控循环单元&#xff09;模型的一种时间序列预测方法。以下是…...

【ROS】让你的回调函数并行起来

【前言】 众所周知&#xff0c;ROS中的所有回调函数&#xff0c;都由 ros::spin() 这个家伙来统一管理和唤醒。这里说的是所有通过ROS方式创建出来的回调函数&#xff0c;比如ros::Subscriber、ros::Timer等等的回调函数。 【举例】 我们先来看一个示例节点&#xff1a; #i…...

M12电连接器的编码分类及应用领域分析

12电连接器的编码主要包括A、B、C、D、X、S、T、K、L等类型&#xff0c;每种编码都有其特定的应用场景和功能&#xff1a; A编码&#xff1a;适用于传感器、直流电、1G以太网。 B编码&#xff1a;主要用于PROFIBUS总线系统。 C编码&#xff1a;适用于交流电。 D编码&#x…...

基于YOLOv8的道路裂缝坑洼检测系统

基于YOLOv8的道路裂缝坑洼检测系统 (价格88) 包含 【“裂缝”,“凹坑”】 2个类 通过PYQT构建UI界面&#xff0c;包含图片检测&#xff0c;视频检测&#xff0c;摄像头实时检测。 &#xff08;该系统可以根据数据训练出的yolov8的权重文件&#xff0c;运用在其他检测系…...

蓝鹏测径仪非标定制订制流程

测径仪通常属于非标定制设备&#xff0c;非标定制意味着这些设备不是按照标准规格批量生产的&#xff0c;而是根据特定的客户需求和应用场景设计和制造的。例如&#xff0c;某些测径仪可能需要特殊的测量范围、精度、传感器或软件来满足特定的工业检测要求。 测径仪非标定制的…...

eNSP-Cloud(实现本地电脑与eNSP内设备之间通信)

说明&#xff1a; 想象一下&#xff0c;你正在用eNSP搭建一个虚拟的网络世界&#xff0c;里面有虚拟的路由器、交换机、电脑&#xff08;PC&#xff09;等等。这些设备都在你的电脑里面“运行”&#xff0c;它们之间可以互相通信&#xff0c;就像一个封闭的小王国。 但是&#…...

Xshell远程连接Kali(默认 | 私钥)Note版

前言:xshell远程连接&#xff0c;私钥连接和常规默认连接 任务一 开启ssh服务 service ssh status //查看ssh服务状态 service ssh start //开启ssh服务 update-rc.d ssh enable //开启自启动ssh服务 任务二 修改配置文件 vi /etc/ssh/ssh_config //第一…...

Auto-Coder使用GPT-4o完成:在用TabPFN这个模型构建一个预测未来3天涨跌的分类任务

通过akshare库&#xff0c;获取股票数据&#xff0c;并生成TabPFN这个模型 可以识别、处理的格式&#xff0c;写一个完整的预处理示例&#xff0c;并构建一个预测未来 3 天股价涨跌的分类任务 用TabPFN这个模型构建一个预测未来 3 天股价涨跌的分类任务&#xff0c;进行预测并输…...

Maven 概述、安装、配置、仓库、私服详解

目录 1、Maven 概述 1.1 Maven 的定义 1.2 Maven 解决的问题 1.3 Maven 的核心特性与优势 2、Maven 安装 2.1 下载 Maven 2.2 安装配置 Maven 2.3 测试安装 2.4 修改 Maven 本地仓库的默认路径 3、Maven 配置 3.1 配置本地仓库 3.2 配置 JDK 3.3 IDEA 配置本地 Ma…...

淘宝扭蛋机小程序系统开发:打造互动性强的购物平台

淘宝扭蛋机小程序系统的开发&#xff0c;旨在打造一个互动性强的购物平台&#xff0c;让用户在购物的同时&#xff0c;能够享受到更多的乐趣和惊喜。 淘宝扭蛋机小程序系统拥有丰富的互动功能。用户可以通过虚拟摇杆操作扭蛋机&#xff0c;实现旋转、抽拉等动作&#xff0c;增…...

解析奥地利 XARION激光超声检测系统:无膜光学麦克风 + 无耦合剂的技术协同优势及多元应用

在工业制造领域&#xff0c;无损检测&#xff08;NDT)的精度与效率直接影响产品质量与生产安全。奥地利 XARION开发的激光超声精密检测系统&#xff0c;以非接触式光学麦克风技术为核心&#xff0c;打破传统检测瓶颈&#xff0c;为半导体、航空航天、汽车制造等行业提供了高灵敏…...

破解路内监管盲区:免布线低位视频桩重塑停车管理新标准

城市路内停车管理常因行道树遮挡、高位设备盲区等问题&#xff0c;导致车牌识别率低、逃费率高&#xff0c;传统模式在复杂路段束手无策。免布线低位视频桩凭借超低视角部署与智能算法&#xff0c;正成为破局关键。该设备安装于车位侧方0.5-0.7米高度&#xff0c;直接规避树枝遮…...

Chrome 浏览器前端与客户端双向通信实战

Chrome 前端&#xff08;即页面 JS / Web UI&#xff09;与客户端&#xff08;C 后端&#xff09;的交互机制&#xff0c;是 Chromium 架构中非常核心的一环。下面我将按常见场景&#xff0c;从通道、流程、技术栈几个角度做一套完整的分析&#xff0c;特别适合你这种在分析和改…...

Monorepo架构: Nx Cloud 扩展能力与缓存加速

借助 Nx Cloud 实现项目协同与加速构建 1 &#xff09; 缓存工作原理分析 在了解了本地缓存和远程缓存之后&#xff0c;我们来探究缓存是如何工作的。以计算文件的哈希串为例&#xff0c;若后续运行任务时文件哈希串未变&#xff0c;系统会直接使用对应的输出和制品文件。 2 …...

python可视化:俄乌战争时间线关键节点与深层原因

俄乌战争时间线可视化分析&#xff1a;关键节点与深层原因 俄乌战争是21世纪欧洲最具影响力的地缘政治冲突之一&#xff0c;自2022年2月爆发以来已持续超过3年。 本文将通过Python可视化工具&#xff0c;系统分析这场战争的时间线、关键节点及其背后的深层原因&#xff0c;全面…...