从类型论的角度看Rust的生命周期
Rust的生命周期尽管细化了一些编程语言中的类型,但没有细化完全,或者说在Rust中有些符号滥用,关系表示的并不是那么明晰。用不严谨的类型论的符号可以表示如下。需要注意的就是生命周期可以视作类型的“类型”,用T : 'a表示,而生命周期之间的关系则是同一层级的类型之间的关系用'a <: 'b表示'a的生命周期长于'b。 12345678910111213'static 是 'a 的子类型, 'a 是 'b 的子类型, 即: 'static <: 'a <: 'bi32 : 'staticString : 'staticT : 'static若T : 'static, 则&T = &'a T : 'a. 这里的&T似乎应该视作&'a T. 万恶的自动推导将细节隐藏起来了. 暴论: Rust的学习难度就是因为这些干扰语言一致性的语法糖造成的。若T : 'a,...
Cpp指针、引用 VS Rust所有权、借用
Rust的所有权与变量遮蔽有关,与C++的移动语义还是有一些区别。比如在C++下述操作中const变量d和j并不会随std::move而清空: 123456789std::string a{"1"};std::string b{"12"};std::string c{"123"};std::string const d{"1234"};std::string i{std::move(a)};i = std::move(b);i = std::move(d);std::string const j{std::move(c)};std::string const k{std::move(j)}; 对于引用: 123456789101112131415161718std::string a{"1"};std::string...
引用折叠、万能引用和完美转发
本文给出引用折叠、万能引用和完美转发的相关代码。需要注意的是万能引用(T &&arg)中匹配的类型T,要么是U,要么是U&&。forward的返回值,要么是不具名左值引用,要么是不具名右值引用。在wrapper中,对forward的调用,要么是forward<U>(U &&arg),要么是forward<U&>(U...
WSL的安装与迁移
管理员身份运行PowerShell,执行: 1234567wsl -l -vwsl --install Ubuntu-22.04wsl --shutdown Ubuntu-22.04wsl --export Ubuntu-22.04 E:\Ubuntu22.tarwsl --unregister Ubuntu-22.04wsl --import Ubuntu-22.04 E:\WSL\Ubuntu22 E:\Ubuntu22.tar --version 2ubuntu2204 config --default-user <username> 注意:需要手动创建E:\WSL\Ubuntu22目录 具体可见: WSL 的基本命令 | Microsoft Learn WSL安装linux系统以及从C盘迁移至其他盘_哔哩哔哩_bilibili
在windows系统上部署whisper-rs
本文介绍如何在Windows系统上部署whisper-rs项目进行语言流式转录。 前置条件 构建该项目需要在VS中安装Clang组件,具体教程见:How to Install Clang on Windows - wikiHow。安装组件后,需先打开Developer Command Prompt for VS 2022,在其中输入 Command Prompt for VS 20221where.exe clang 将显示的路径所对应的形如C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin的路径作为环境变量LIBCLANG_PATH,并将路径添加到PATH中。注意不是Llvm\bin,而是Llvm\x64\bin。 构建并使用 12git clone --recursive https://github.com/tazz4843/whisper-rs.gitcd whisper-rs 下载ggerganov/whisper.cpp at...
在windows系统上部署whisper.cpp
本文介绍如何在Windows系统上部署whisper.cpp项目进行语言流式转录。 克隆仓库并下载base.en模型 123git clone https://github.com/ggerganov/whisper.cpp.gitcd whisper.cpp.\models\download-ggml-model.cmd base.en base.en模型是English-only model,若使用Multilingual model请去掉.en。所有可用模型,请见:whisper.cpp/models/README.md at master · ggerganov/whisper.cpp。 下载 vcpkg 并配置环境变量 请参见: 在 Visual Studio Code 中使用 CMake 安装和管理包 | Microsoft...
在Windows系统上部署openai-whisper模型
本文介绍如何在Windows系统上部署openai/whisper模型。除开ffmpeg的安装外,其余步骤都可参见openai/whisper: Robust Speech Recognition via Large-Scale Weak Supervision。建议使用scoop安装ffmpeg,因为Chocolatey无法更改自定义默认下载目录。 安装Scoop和ffmpeg音频处理库 12345# 安装powershellSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserirm get.scoop.sh -outfile 'install.ps1'.\install.ps1 -ScoopDir 'E:\ProgramHome\Scoop' -ScoopGlobalDir 'E:\ProgramHome\GlobalScoopApps' -NoProxyscoop install ffmpeg 安装whisper 1234#...
配置Hexo+Obsidian
详细步骤见下述链接,需要注意的是需要忽略.obsidian/workspace.json。 若使用hexo-backlink,除了需要修改Github Action文件外,还需在根目录的_config.yml中添加 12backlink: enable: true More info: Obsidian+Git完美维护Hexo博客 - 知乎 Cyrusky/hexo-backlink: This plugin is for transfer Obsidian-type backlink to standard hexo in-site post link.
配置butterfly主题
本文章介绍如何使用Hexo的butterfly主题。 安装 1git submodule add -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly 应用主题 修改 Hexo 根目錄下的 _config.yml,把主題改為 butterfly 1theme: butterfly 升级建议 為了減少升級主題後帶來的不便,請使用以下方法(建議,可以不做): 在 hexo 的根目錄創建一個文件 _config.butterfly.yml,並把主題目錄的 _config.yml 內容複製到 _config.butterfly.yml 去。 安装插件 将Github Action修改为如下内容: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051# .github/workflows/pages.ymlname: Pageson: push: ...
Hello World
欢迎使用 Hexo!这是您的第一篇帖子。查看 文档 了解更多信息。如果您在使用 Hexo 时遇到任何问题,您可以在 故障排除 中找到答案,也可以在 GitHub 上向我提问。 快速入门 创建新帖子 1$ hexo new "My New Post" More info: Writing 运行服务器 1$ hexo server More info: Server 生成静态文件 1$ hexo generate More info: Generating 部署到远程站点 1$ hexo deploy More info: Deployment