ayanaminn / n46whisper Goto Github PK
View Code? Open in Web Editor NEWWhisper based Japanese subtitle generator
License: MIT License
Whisper based Japanese subtitle generator
License: MIT License
加载模型 Loading model...
/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_token.py:72: UserWarning:
The secret HF_TOKEN
does not exist in your Colab secrets.
To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.
You will be able to reuse this secret in all of your notebooks.
Please note that authentication is recommended but still optional to access public models or datasets.
warnings.warn(
model.bin: 100%
3.09G/3.09G [00:31<00:00, 159MB/s]
gpt翻译我查了很长时间,所谓的error 429是每日上限值最大了,而且好像说这个东西与一个重置时间,这个时间是多少我也没找到,每次翻译的时候出现这个说的是7m12s以后重试,请问这个就是重置时间么。如果不是,请问这个问题应该如何解决和避免呢?
转录完之后会有云端的实时保存,但是ai翻译的部分坏了的话需要从whisper重新转录开始,就很麻烦。
要是ai翻译的部分可以单独添加一个上传字幕文件的功能的话会避免一些colab算力浪费。
虽然并不是什么问题,但是长视频看不到进度条真的有点焦虑,单单提一嘴,不加也行。
感觉也可以把视频提取音频这一功能单独抽取出来
我做过相关AI字幕的工作,不方便上传代码,但有几个方向值得借鉴:
最后时间轴的结果里无需人为修正的准确结果可以达到80%+
选择语言为en时不能以英文据点为分行标记分割,包括is_spilt和spilt_method等设置都不能改变输出ass文件的分行;相对而言日语的分行就很明确,本问题自4.15日更新后出现,请问是否为faster-whisper的问题?
尝试跑了一个1h+的mp4视频(源),时间轴基本上是乱的。一开始就提前了3s左右,我把所有轴都往后了3s以后,大概30s后时间轴又逐渐慢了若干秒
RateLimitError Traceback (most recent call last)
in translate(OOO0OO000O0OOO0OO, OO00O0OOOO00O0O00)
33 try :#line:27
---> 34 OO00OO000O0O000O0 =openai .ChatCompletion .create (model ="gpt-3.5-turbo",messages =[{"role":"user","content":f"Please help me to translate,{OO00O0OOOO00O0O00}
to {OOO0OO000O0OOO0OO.language}, please return only translated content not include the origin text",}],)#line:37
35 O00O000000000O00O =(OO00OO000O0O000O0 ["choices"][0 ].get ("message").get ("content").encode ("utf8").decode ())#line:44
12 frames
RateLimitError: You exceeded your current quota, please check your plan and billing details.
During handling of the above exception, another exception occurred:
RateLimitError Traceback (most recent call last)
/usr/local/lib/python3.9/dist-packages/openai/api_requestor.py in _interpret_response_line(self, rbody, rcode, rheaders, stream)
680 stream_error = stream and "error" in resp.data
681 if stream_error or not 200 <= rcode < 300:
--> 682 raise self.handle_error_response(
683 rbody, rcode, resp.data, rheaders, stream_error=stream_error
684 )
RateLimitError: You exceeded your current quota, please check your plan and billing details.
为什么会出现这个啊 就一个两分钟的视频 而且前面日语的字幕也只扒了三句出来
openai已经开放whisper的api,可不可以直接调用API来转录,似乎还支持prompt
会提示这个 module 'openai' has no attribute 'ChatCompletion'
红线提示的代码是以下的最后一行:
except Exception as e:
# TIME LIMIT for open api , pay to reduce the waiting time
sleep_time = int(60 / self.key_len)
time.sleep(sleep_time)
print(e, f"will sleep {sleep_time} seconds")
# self.rotate_key()
openai.api_key = self.key
completion = openai.ChatCompletion.create(
自己瞎查了一通的结果是 这个好像没啥问题啊
就是接入到模型接口里去的功能吧这行代码,然后格式不就是这样的吗
问GPT然后GPT也说是对的,为啥捏
能否添加 openai 的url链接
比如我用第三方的 openai api
https://github.com/SakuraLLM/Sakura-13B-Galgame
如果要做这个事情太麻烦,那就当我没说吧。。。看作者也是挺忙的。
srt2ass的split参数这里只能设定modest (5)或者aggressive感觉还是不能适配到所有应用场景,假如能加一个参数自由调整就好了
比如说我现在烤广播的话,5还是会切出一些比较碎的轴
用Google Colab主要是想借用GPU性能……AI翻译的部分是调用远程API,基本用不上GPU算力?
能不能把上一个部分添加一个导出srt的选项,然后在自己本地跑最后一块AI翻译?
免费的API实在是太慢了,挂Google Colab的话等着等着就超时掉线了OTZ
点谷歌网盘步骤后只有验证谷歌账号,没有运作。过一会后会自动执行第二步本地上传
发现上传谷歌云盘太慢了,也很耗梯子,能否支持直接在windows电脑上处理?
尝试上传多个谷歌盘的文件,似乎是只能重复生成上传的最后一个的。
以及现在上传的文件如果有包含中文名,生成之后的同名文件中文名会被去掉,不知道这个有没有解。
还有我只需要生成srt文件,似乎现在只能ass和srt同时生成,不能只生成srt
It's a new translation model published by Meta. The model size is about 3.3GB which is runnable on Colab. Maybe it's a good idea to tranlsate with it.
放在根目录下和子目录下都不显示,所以无法选择
(github怎么按了回车键直接就发出去了……我还没编辑完)
跑了个联动回,语音转文字后还需要逐行去标注说话人
然后翻到了一个声纹识别的包:
https://github.com/pyannote/pyannote-audio
应用项目:
https://github.com/yinruiqing/pyannote-whisper
https://github.com/lablab-ai/Whisper-transcription_and_diarization-speaker-identification-
https://github.com/JimLiu/whisper-podcast-subtitles
想问问考不考虑把这个集成进去OTZ
在多人联动的活动中应该能起到大作用……
我看了下代码,你发起下载请求后,就直接调用sleep函数了,这样会导致下载请求无法发起,必须强制暂停代码运行才行,我用的是Google浏览器,其余Chromium浏览器也会出现这种情况
但生成的字幕文件有些没翻译,还是原来的字幕
Originally posted by YMStar May 19, 2023
字幕生成质量不错!支持
■功能
在参数选择那里提供一个新的选项,「是否对存在空格的行实施分割」。用户可根据自身需要选择「是」或「否」。
如果选择了「是」,则对存在空格的行进行分割,分割后的若干行均临时采用相同时间戳,且添加了adjust_required标记提示调整时间戳避免叠轴。
效果如下
○分割前
Dialogue: 0,0:01:06.52,0:01:17.52,default,,0,0,0,,スマホ見てる時点でもう失格です 後輩メンバーから言いたい放題言われながらも必死にアピールを続け
○分割后
Dialogue: 0,0:01:06.52,0:01:17.52,default,,0,0,0,,スマホ見てる時点でもう失格です
Dialogue: 0,0:01:06.52,0:01:17.52,default,,0,0,0,,後輩メンバーから言いたい放題言われながらも必死にアピールを続け(adjust_required)
■添加该功能的理由
目前Whisper转录时可能会有好几句话放在了同一行,导致一行过长。特别是在多人说话时该情况出现频率很高。如果能拆开的话,轴只需要把分出来的同一个时间戳的若干行重新调整一下各行的时长就能解决问题了。相当于代劳了aegisub的split。
※ 因为已经写好这个功能试着跑过一遍了,如果觉得确实有必要添加该功能的话,我可以提交PR。
Originally posted by MrFutureV March 21, 2023
如题
我有訓練了一些特定模型的fine-tuned版本,想說能不能在模型載入時可以選擇本地端或網路來源的model
N46:
なんて言ったらいいんだろう
約束だよ
これさすがノーマルでしょ?
私アメリカン…あ、今はクルーザーって言うんだっけ?
whisperdesktop:
ああ… なんて言ったらいいんだろう
約束…だよ
これ さすがノーマルでしょ?
私 アメリカ… あ 今はクルザって言うんだっけ?
whisperdesktop(用的新的ggmlv2模型)的结果会显示背景音、语气词、停顿,不过它的时间轴有大问题,语音结束立刻会到下一句
N46时间轴没有问题,不会显示背景音和语气词,停顿空格也几乎没有,我用的v1模型,因为v2模型没有标点符号
什么原因导致的呢?优点能结合起来就完美了
OutOfMemoryError Traceback (most recent call last)
in
46 torch.cuda.empty_cache()
47 print('加载模型 Loading model...')
---> 48 model = whisper.load_model(model_size)
49
50 #Transcribe
8 frames
/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py in convert(t)
985 return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None,
986 non_blocking, memory_format=convert_to_format)
--> 987 return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
988
989 return self._apply(convert)
OutOfMemoryError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 14.75 GiB total capacity; 13.66 GiB already allocated; 6.81 MiB free; 14.18 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
不是做翻译的,偶然发现的笔记本,所以功能建议可以酌情考虑再决定是否增加~
使用笔记本后有两点问题:
在云盘新建文件夹voice,并上传音频文件到其中,使用笔记本读取不到voice文件夹中的音频。(我也没看见select按钮,可能是没选到音频的缘故)
使用本地上传文件,上传了三个音频文件,最后自动下载了第一个,其余被忽略了。
功能建议:
我想要批量转化音频,1k-10k这个样子,我希望可以让笔记本读取云盘内每一文件夹下的所有音频,然后按顺序批量转换。
能不能增加一个导出为txt的选项?txt只导出文本~
原本这样
--------------
[0:0:0:1:0] お願いします。
[0:0:0:1:0] お願いします。
[0:0:0:1:0] お願いします。
--------------
txt导出为这样
--------------
お願いします。
--------------
(当然,,这一点没什么必要,我也可以本地转换ass为txt,然后去除多余参数)
还有就是批量下载上千个txt有点头疼,如果能直接在colab笔记本的show code界面看到转换后的结果,那直接复制就好了,不用下载了
During handling of the above exception, another exception occurred:
RateLimitError Traceback (most recent call last)
/usr/local/lib/python3.9/dist-packages/openai/api_requestor.py in _interpret_response_line(self, rbody, rcode, rheaders, stream)
681 stream_error = stream and "error" in resp.data
682 if stream_error or not 200 <= rcode < 300:
--> 683 raise self.handle_error_response(
684 rbody, rcode, resp.data, rheaders, stream_error=stream_error
685 )
RateLimitError: You exceeded your current quota, please check your plan and billing details.
如题,谢谢
可以部署到本地嘛 在线上传有点慢
我想自己上传字幕让它翻译的话,就是除了翻译字幕以外,不需要其他的功能,代码要在哪里,怎么改呢
需要自己在流里面添加才有
name 'model_size' is not defined
是后台模型配置错误吗?
本人经常制作2小时以上的电影字幕 感谢大佬给出帮助
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.