Jetson 部署 Faster Whisper
文章目录
- Whisper
- Faster Whisper
- 安装使用
- 尝试WSL部署
- 尝试 Jetson 部署
- 时间戳
- 实时转录
Whisper
Whisper 是一种通用语音识别模型。它是在大量不同音频数据集上进行训练的,也是一个多任务模型,可以执行多语言语音识别、语音翻译和语言识别。
测试,用Chattts生成一段语音:四川美食确实以辣闻名,但也有不辣的选择。比如甜水面、赖汤圆、蛋烘糕、叶儿粑等,这些小吃口味温和,甜而不腻,也很受欢迎。
$ pip install -U openai-whisper
$ sudo apt update && sudo apt install ffmpeg
$ pip install setuptools-rust$ whisper ../audio.wav --model tiny
100%|█████████████████████████████████████| 72.1M/72.1M [00:36<00:00, 2.08MiB/s]
/home/jetson/.local/lib/python3.8/site-packages/whisper/__init__.py:146: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.checkpoint = torch.load(fp, map_location=device)
/home/jetson/.local/lib/python3.8/site-packages/whisper/transcribe.py:115: UserWarning: FP16 is not supported on CPU; using FP32 insteadwarnings.warn("FP16 is not supported on CPU; using FP32 instead")
Detecting language using up to the first 30 seconds. Use `--language` to specify the language
Detected language: Chinese
[00:00.000 --> 00:03.680] 四川美時確實以辣文明 但以有不辣的選擇
[00:03.680 --> 00:07.200] 比如潛水面 賴湯圓 再轟高夜熱八等
[00:07.200 --> 00:11.560] 這些小市口維溫和 然後甜而不膩也很受歡迎
这个是CPU运行的😂,GPU都没带喘的。
Faster Whisper
fast-whisper 是使用 CTranslate2 重新实现 OpenAI 的 Whisper 模型,CTranslate2 是 Transformer 模型的快速推理引擎。
Funasr有个大问题,它的实时转录是CPU的,很慢,GPU的支持离线语音转文字,但又不能实时。找到了一个faster-whisper可以支持实时GPU转录,也支持中文。
- Faster-Whisper 实时识别电脑语音转文本
- 模型:faster-whisper-large-v3
安装使用
pip install faster-whisper
from faster_whisper import WhisperModelmodel_size = "large-v3"# Run on GPU with FP16
# model = WhisperModel(model_size, device="cuda", compute_type="float16")# or run on GPU with INT8
model = WhisperModel(model_size, device="cuda", compute_type="int8_float16")
# or run on CPU with INT8
# model = WhisperModel(model_size, device="cpu", compute_type="int8")segments, info = model.transcribe("audio.mp3", beam_size=5)print("Detected language '%s' with probability %f" % (info.language, info.language_probability))for segment in segments:print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
尝试WSL部署
- Cuda:12.6
- Cudnn:9.2
直接运行,报错Could not load library libcudnn_ops_infer.so.8. Error: libcudnn_ops_infer.so.8: cannot open shared object file: No such file or directory,这是需要cublas,cudnn的python库:
pip install nvidia-cublas-cu12 nvidia-cudnn-cu12export LD_LIBRARY_PATH=`python3 -c 'import os; import nvidia.cublas.lib; import nvidia.cudnn.lib; print(os.path.dirname(nvidia.cublas.lib.__file__) + ":" + os.path.dirname(nvidia.cudnn.lib.__file__))'`
但是仍然跑不起来,因为:
Version 9+ of nvidia-cudnn-cu12 appears to cause issues due its reliance on cuDNN 9 (Faster-Whisper does not currently support cuDNN 9). Ensure your version of the Python package is for cuDNN 8.
那我安装 Cudnn 8 不就行了?果断下载cudnn8 for cuda 12.x,但是每次都安装cudnn9.4,除了降cuda版本,否则没办法恢复到cudnn8。
尝试 Jetson 部署
- Cuda:11.4
- Cudnn:8.6.0
简直量身定制啊!首先尝试安装cudnn python库:
$ pip3 install faster-whisper -i https://mirrors.aliyun.com/pypi/simple/# 贴心的提示我们:For all these methods below, keep in mind the above note
# regarding CUDA versions. Depending on your setup, you may need to install the
# CUDA 11 versions of libraries that correspond to the CUDA 12 libraries listed
# in the instructions below.$ pip install --extra-index-url https://pypi.nvidia.com nvidia-cudnn-cu11
...
The installation of nvidia-cudnn-cu11 for version 9.0.0.312 failed.This is a special placeholder package which downloads a real wheel packagefrom https://pypi.nvidia.com. If https://pypi.nvidia.com is not reachable, wecannot download the real wheel file to install.You might try installing this package via$ pip install --extra-index-url https://pypi.nvidia.com nvidia-cudnn-cu11Here is some debug information about your platform to include in any bugreport:Python Version: CPython 3.8.10Operating System: Linux 5.10.104-tegraCPU Architecture: aarch64nvidia-smi command not found. Ensure NVIDIA drivers are installed.
原来是 nvidia-cudnnn-cu11没有aarch64 Arm
版本!但是nvidia-cudnn-cu12有。
怎么办,安装cuda 12.2?Jetson的系统是离线刷机,jetpack 6确实支持12.2和cudnn8:
已经准备买新的固态刷机了,但是太麻烦了,得装虚拟机装刷机SDK,得拆机箱改跳帽,得重新配置ssh网络连接,关键是,得花钱!
不试试怎么行呢,我不信邪,就安装cudnn12 python库:
pip install --extra-index-url https://pypi.nvidia.com nvidia-cudnn-cu12
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://pypi.nvidia.com
Collecting nvidia-cudnn-cu12Downloading nvidia_cudnn_cu12-9.4.0.58-py3-none-manylinux2014_aarch64.whl.metadata (1.6 kB)
Collecting nvidia-cublas-cu12 (from nvidia-cudnn-cu12)Downloading https://pypi.nvidia.com/nvidia-cublas-cu12/nvidia_cublas_cu12-12.6.1.4-py3-none-manylinux2014_aarch64.whl (376.7 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 376.7/376.7 MB 12.9 MB/s eta 0:00:00
Downloading nvidia_cudnn_cu12-9.4.0.58-py3-none-manylinux2014_aarch64.whl (572.7 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 572.7/572.7 MB 1.1 MB/s eta 0:00:00
Installing collected packages: nvidia-cublas-cu12, nvidia-cudnn-cu12
Successfully installed nvidia-cublas-cu12-12.6.1.4 nvidia-cudnn-cu12-9.4.0.58
跑一下demo:
test.py
preprocessor_config.json: 100%|████████████████████████████████| 340/340 [00:00<00:00, 118kB/s]
config.json: 100%|█████████████████████████████████████████████| 2.39k/2.39k [00:00<00:00, 1.03MB/s]
vocabulary.json: 100%|█████████████████████████████████████████| 1.07M/1.07M [00:00<00:00, 1.13MB/s]
tokenizer.json: 100%|██████████████████████████████████████████| 2.48M/2.48M [00:01<00:00, 2.14MB/s]
model.bin: 100%|███████████████████████████████████████████████| 3.09G/3.09G [03:18<00:00, 9.89MB/s]
Traceback (most recent call last):File "test.py", line 9, in <module>model = WhisperModel(model_size, device="cuda", compute_type="int8_float16")File "/home/jetson/.local/lib/python3.8/site-packages/faster_whisper/transcribe.py", line 145, in __init__self.model = ctranslate2.models.Whisper(
ValueError: This CTranslate2 package was not compiled with CUDA support
Holy🤬,这又是咋回事,找一下:This CTranslate2 package was not compiled with CUDA support #1306,跳过他们的讨论,结合faster-whisper库里的描述:
Note: Latest versions of ctranslate2 support CUDA 12 only. For CUDA 11, the current workaround is downgrading to the 3.24.0 version of ctranslate2 (This can be done with pip install --force-reinstall ctranslate2==3.24.0 or specifying the version in a requirements.txt).
又是cuda11的幺蛾子,它说要使用降级的方法:
$ pip install --force-reinstall ctranslate2==3.24.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
mediapipe 0.8.4 requires opencv-contrib-python, which is not installed.
onnx-graphsurgeon 0.3.12 requires onnx, which is not installed.
d2l 0.17.6 requires numpy==1.21.5, but you have numpy 1.24.4 which is incompatible.
d2l 0.17.6 requires requests==2.25.1, but you have requests 2.32.3 which is incompatible.
faster-whisper 1.0.3 requires ctranslate2<5,>=4.0, but you have ctranslate2 3.24.0 which is incompatible.
呸!😶
我试试自己编一个cuda版本的:https://opennmt.net/CTranslate2/installation.html#compile-the-c-library
$ pip3 uninstall ctranslate2 whisper-ctranslate2
$ git clone --recursive https://github.com/OpenNMT/CTranslate2.git
$ mkdir build && cd build
$ cmake ..
...
CMake Error at CMakeLists.txt:294 (message):Intel OpenMP runtime libiomp5 not found-- Configuring incomplete, errors occurred!
哪来的intel?找找,原来是,By default, the library is compiled with the Intel MKL backend which should be installed separately. See the Build options to select or add another backend. 改一下,不用老in家的:
# 老张我给你表演什么叫一镜到底,注意看,我只表演一次:
$ cmake .. -DOPENMP_RUNTIME=COMP -DWITH_MKL=OFF -DWITH_CUDA=ON -DWITH_CUDNN=ON
$ make -j32
$ sudo make install
$ sudo ldconfig
$ cd ../python
$ pip install -r install_requirements.txt
$ python setup.py bdist_wheel
$ pip install dist/*.whl
喜大普奔!
时间戳
from faster_whisper import WhisperModelmodel_size = "large-v3"# Run on GPU with FP16
# model = WhisperModel(model_size, device="cuda", compute_type="float16")# or run on GPU with INT8
model = WhisperModel(model_size, device="cuda", compute_type="int8_float16")
# or run on CPU with INT8
# model = WhisperModel(model_size, device="cpu", compute_type="int8")segments, _ = model.transcribe("audio.wav", word_timestamps=True)for segment in segments:for word in segment.words:print("[%.2fs -> %.2fs] %s" % (word.start, word.end, word.word))
[0.00s -> 0.24s] 四
[0.24s -> 0.44s] 川
[0.44s -> 0.58s] 美
[0.58s -> 0.78s] 食
[0.78s -> 1.10s] 确
..
[9.72s -> 9.96s] 腻
[9.96s -> 10.42s] 也
[10.42s -> 10.68s] 很
[10.68s -> 10.82s] 受
[10.82s -> 11.04s] 欢
[11.04s -> 11.22s] 迎
实时转录
Whisper 实时流式传输,用于长时间语音到文本的转录和翻译。Whisper 是最近最先进的多语言语音识别和翻译模型之一,然而,它并不是为实时转录而设计的。在本文中,我们在 Whisper 之上构建并创建了 Whisper-Streaming,这是一种实时语音转录和类似 Whisper 模型翻译的实现。 Whisper-Streaming 使用本地协议策略和自适应延迟来实现流式转录。我们证明 Whisper-Streaming 在未分段的长格式语音转录测试集上实现了高质量和 3.3 秒的延迟,并且我们在多语言会议上展示了其作为实时转录服务组件的鲁棒性和实际可用性。
$ git clone git@github.com:ufal/whisper_streaming.git
$ cd whisper_streaming
$ python3 whisper_online.py ../audio.wav --language zh --min-chunk-size 1
INFO Audio duration is: 11.68 seconds
INFO Loading Whisper large-v2 model for zh...
INFO done. It took 14.19 seconds.
DEBUG PROMPT:
DEBUG CONTEXT:
DEBUG transcribing 1.00 seconds from 0.00
DEBUG >>>>COMPLETE NOW: (None, None, '')
DEBUG INCOMPLETE: (0.0, 0.98, '四川美食群')
DEBUG len of buffer now: 1.00
DEBUG ## last processed 1.00 s, now is 5.30, the latency is 4.29
DEBUG PROMPT:
DEBUG CONTEXT:
DEBUG transcribing 5.30 seconds from 0.00
DEBUG >>>>COMPLETE NOW: (0.0, 0.88, '四川美食')
DEBUG INCOMPLETE: (0.88, 5.26, '确实以辣为名,但也有不辣的选择,比如甜水面赖淘宝。')
DEBUG len of buffer now: 5.30
11643.5227 0 880 四川美食
11643.5227 0 880 四川美食
DEBUG ## last processed 5.30 s, now is 11.64, the latency is 6.35
DEBUG PROMPT:
DEBUG CONTEXT: 四川美食
DEBUG transcribing 11.64 seconds from 0.00
DEBUG >>>>COMPLETE NOW: (None, None, '')
DEBUG INCOMPLETE: (0.88, 11.24, '確實以辣聞名,但也有不辣的選擇,比如甜水麵、瀨湯圓、炸烘糕 、葉子粑等,這些小吃口味溫和,然後甜而不膩,也很受歡迎。')
DEBUG len of buffer now: 11.64
DEBUG ## last processed 11.64 s, now is 21.61, the latency is 9.96
DEBUG PROMPT:
DEBUG CONTEXT: 四川美食
DEBUG transcribing 11.68 seconds from 0.00
DEBUG >>>>COMPLETE NOW: (None, None, '')
DEBUG INCOMPLETE: (0.88, 11.32, '确实以辣闻名,但也有不辣的选择,比如甜水面、赖汤圆、炸烘糕 叶、热巴等,这些小吃口味温和,然后甜而不腻,也很受欢迎。')
DEBUG len of buffer now: 11.68
DEBUG ## last processed 21.61 s, now is 31.53, the latency is 9.92
DEBUG last, noncommited: (0.88, 11.32, '确实以辣闻名,但也有不辣的选择,比如甜水面、赖汤圆、炸烘糕叶、热巴等,这些小吃口味温和,然后甜而不腻,也很受欢迎。')
31528.1091 880 11320 确实以辣闻名,但也有不辣的选择,比如甜水面、赖汤圆、炸烘糕叶、热巴等,这些小吃口味温和,然后甜而不腻,也很受欢迎。
31528.1091 880 11320 确实以辣闻名,但也有不辣的选择,比如甜水面、赖汤圆、炸烘糕叶、热巴等,这些小吃口味温和,然后甜而不腻,也很受欢迎。
注:更改模型量化:
# this worked fast and reliably on NVIDIA L40
# model = WhisperModel(model_size_or_path, device="cuda", compute_type="float16", download_root=cache_dir)# or run on GPU with INT8
# tested: the transcripts were different, probably worse than with FP16, and it was slightly (appx 20%) slower
model = WhisperModel(model_size_or_path, device="cuda", compute_type="int8_float16")
相关文章:

Jetson 部署 Faster Whisper
文章目录 WhisperFaster Whisper安装使用尝试WSL部署尝试 Jetson 部署时间戳 实时转录 Whisper Whisper 是一种通用语音识别模型。它是在大量不同音频数据集上进行训练的,也是一个多任务模型,可以执行多语言语音识别、语音翻译和语言识别。 测试&#x…...

测试开发基础——测试分类
四、测试分类 1. 按照测试目标分类 1.1. 界面测试 肉眼看到的任何元素都需要进行测试 界面测试(简称U测试),指按照界面的需求(一般是U设计稿)和界面的设计规则,对我们软件界面所展示的全部内容进行测试…...

【计网】数据链路层:概述之位置|地位|链路|数据链路|帧
✨ Blog’s 主页: 白乐天_ξ( ✿>◡❛) 🌈 个人Motto:他强任他强,清风拂山岗! 💫 欢迎来到我的学习笔记! ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ 1. 在OSI体系结构中的位置 1. 位置:数…...
【Android】NestedScrollView的简单用法与滚动冲突、滑动冲突
一、NestedScrollView 1. 什么是 NestedScrollView NestedScrollView 是 Android 中一个用于处理垂直方向滚动的布局组件,它继承自 FrameLayout,同时支持嵌套滑动(Nested Scrolling)机制。相比于传统的 ScrollView,N…...

【LeetCode】每日一题 2024_9_13 预算内的最多机器人数目(滑动窗口、单调队列)
LeetCode 启动! 每日一题的题解重新开始连载! 题目:预算内的最多机器人数目 题目链接:2398. 预算内的最多机器人数目 题目描述 代码与解题思路 func maximumRobots(chargeTimes []int, runningCosts []int, budget int64) (an…...

TypeScript中 any和unknown 的区别
1、给其他变量赋值 any可以给其他类型的变量重新赋值; 但unknown是不行的,unknown 可以保持类型安全,从而减少潜在的错误; 2、使用类型上的方法 any可以用类型上的方法,unknown是不可以的...
道可云人工智能元宇宙每日资讯|第五届深圳国际人工智能展(GAIE)在深圳会展中心举行
道可云元宇宙每日简报(2024年9月12日)讯,今日元宇宙新鲜事有: 成都:最高1000万元,研发川藏线数字文旅元宇宙空间 近日,成都市科学技术局启动2025年成都市第一批科技项目和第一批“常年申报”市…...

Bootstrap布局实例(偏移列)
偏移是一个用于更专业的布局的有用功能。它们可用来给列腾出更多的空间。例如,.col-xs-* 类不支持偏移,但是它们可以简单地通过使用一个空的单元格来实现该效果。 为了在大屏幕显示器上使用偏移,请使用 .col-md-offset-* 类。这些类会把一个…...

IP网络广播服务平台任意文件上传漏洞
文章目录 免责声明搜索语法漏洞描述漏洞复现修复建议 免责声明 本文章仅供学习与交流,请勿用于非法用途,均由使用者本人负责,文章作者不为此承担任何责任 搜索语法 icon_hash"-568806419"漏洞描述 该系统在upload接口处可上传任…...
详细阐述Activity的生命周期
目录 1. onCreate(): 2. onStart(): 3. onResume(): 4. onPause(): 5. onStop(): 6. onRestart(): 7. onDestroy(): 活动生命周期图: 特别说明: 例子ÿ…...

spring boot+vue3学习之旅
前言 使用的是黑马程序员的教程,所有资料都来自于它的公众号,侵权即删,这里只做记录学习,然后我还遇到一个问题,不知道为啥idea每次打开一个新项目,maven路径就要重装,很麻烦。 新建项目 之…...
vue-watch监听功能(侦听器)详解使用
在Vue中,watch侦听器允许我们观察和响应Vue实例上数据的变化。当被侦听的数据发生变化时,可以执行异步操作或开销较大的操作,这是computed属性可能不适合的场景。watch侦听器提供了更灵活的方式来处理数据变化时的副作用。 基本用法 watch选…...

8.第二阶段x86游戏实战2-实现瞬移
免责声明:内容仅供学习参考,请合法利用知识,禁止进行违法犯罪活动! 本次游戏没法给 内容参考于:微尘网络安全 工具下载: 链接:https://pan.baidu.com/s/1rEEJnt85npn7N38Ai0_F2Q?pwd6tw3 提…...
uts+uniapp踩坑记录(vue3项目
杂记: web-view方面 内嵌html使用web-view时,直接用 uni.postMessage({data: {action: message // 你要传的信息}}); 示例上写的是用 document.addEventListener(UniAppJSBridgeReady, function() { uni.postMessage({ data: { action: postMe…...

《深度学习》OpenCV 高阶 图像金字塔 用法解析及案例实现
目录 一、图像金字塔 1、什么是图像金字塔 2、图像金字塔作用 1)金字塔尺度间的图像信息补充 2)目标检测与识别 3)图像融合与拼接 4)图像增强与去噪 5)图像压缩与编码 二、用法解析 1、向下采样 1)概念…...

dirty pages , swapiness 查看SWAP占用进程
文章说了这么多的意思 就是不要过度分配不用的内存。虽然脏块不会写入swap,但是占了物理内存,浪费空间,可能导致进行了很多不必要的交换(虽然判断很少要进swap,判断要不要也要时间。。。)。 To verify whic…...

Spring Boot项目更改项目名称
背景:新项目开始前,往往需要初始化功能,拿到基础版本后更改项目对应的名称等信息。 更改步骤如下: 1、修改目录名称。 打开本地项目,右键修改项目名称。 2、修改maven项目的pom依赖 修改parent及modules项目名称&…...

Hive SQL基础语法及查询实践
目录 基础语法 1. 官网地址 2. 查询语句语法 基本查询(Select…From) 数据准备 (0)原始数据 (1)创建部门表 (2)创建员工表 (3)导入数据 全表和特定列查…...
k8s service如何实现流量转发
1 基本概念 Service:在Kubernetes(K8s)中,Service用于将流量转发到后端的Pod中。Service提供了一种稳定的网络入口,尽管后端的Pod可能会动态改变 kube-proxy: kube-proxy是Kubernetes集群中的核心组件之一࿰…...

每日一练:K个一组翻转链表
25. K 个一组翻转链表 - 力扣(LeetCode) 一、题目要求 给你链表的头节点 head ,每 k 个节点一组进行翻转,请你返回修改后的链表。 k 是一个正整数,它的值小于或等于链表的长度。如果节点总数不是 k 的整数倍&#x…...

wordpress后台更新后 前端没变化的解决方法
使用siteground主机的wordpress网站,会出现更新了网站内容和修改了php模板文件、js文件、css文件、图片文件后,网站没有变化的情况。 不熟悉siteground主机的新手,遇到这个问题,就很抓狂,明明是哪都没操作错误&#x…...
OpenLayers 可视化之热力图
注:当前使用的是 ol 5.3.0 版本,天地图使用的key请到天地图官网申请,并替换为自己的key 热力图(Heatmap)又叫热点图,是一种通过特殊高亮显示事物密度分布、变化趋势的数据可视化技术。采用颜色的深浅来显示…...

C++初阶-list的底层
目录 1.std::list实现的所有代码 2.list的简单介绍 2.1实现list的类 2.2_list_iterator的实现 2.2.1_list_iterator实现的原因和好处 2.2.2_list_iterator实现 2.3_list_node的实现 2.3.1. 避免递归的模板依赖 2.3.2. 内存布局一致性 2.3.3. 类型安全的替代方案 2.3.…...

微信小程序之bind和catch
这两个呢,都是绑定事件用的,具体使用有些小区别。 官方文档: 事件冒泡处理不同 bind:绑定的事件会向上冒泡,即触发当前组件的事件后,还会继续触发父组件的相同事件。例如,有一个子视图绑定了b…...

如何在看板中有效管理突发紧急任务
在看板中有效管理突发紧急任务需要:设立专门的紧急任务通道、重新调整任务优先级、保持适度的WIP(Work-in-Progress)弹性、优化任务处理流程、提高团队应对突发情况的敏捷性。其中,设立专门的紧急任务通道尤为重要,这能…...
ffmpeg(四):滤镜命令
FFmpeg 的滤镜命令是用于音视频处理中的强大工具,可以完成剪裁、缩放、加水印、调色、合成、旋转、模糊、叠加字幕等复杂的操作。其核心语法格式一般如下: ffmpeg -i input.mp4 -vf "滤镜参数" output.mp4或者带音频滤镜: ffmpeg…...

HBuilderX安装(uni-app和小程序开发)
下载HBuilderX 访问官方网站:https://www.dcloud.io/hbuilderx.html 根据您的操作系统选择合适版本: Windows版(推荐下载标准版) Windows系统安装步骤 运行安装程序: 双击下载的.exe安装文件 如果出现安全提示&…...

基于Docker Compose部署Java微服务项目
一. 创建根项目 根项目(父项目)主要用于依赖管理 一些需要注意的点: 打包方式需要为 pom<modules>里需要注册子模块不要引入maven的打包插件,否则打包时会出问题 <?xml version"1.0" encoding"UTF-8…...
数据库分批入库
今天在工作中,遇到一个问题,就是分批查询的时候,由于批次过大导致出现了一些问题,一下是问题描述和解决方案: 示例: // 假设已有数据列表 dataList 和 PreparedStatement pstmt int batchSize 1000; // …...

自然语言处理——Transformer
自然语言处理——Transformer 自注意力机制多头注意力机制Transformer 虽然循环神经网络可以对具有序列特性的数据非常有效,它能挖掘数据中的时序信息以及语义信息,但是它有一个很大的缺陷——很难并行化。 我们可以考虑用CNN来替代RNN,但是…...