红烛AI工具 是 AI Skill Hub 本期精选AI工具之一。综合评分 7.5 分,整体质量较高。我们推荐使用将其纳入你的 AI 工具库,帮助提升工作效率。
红烛AI工具 是一款基于 Rust 开发的开源工具,专注于 AI、语言模型、Rust 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
红烛AI工具 是一款基于 Rust 开发的开源工具,专注于 AI、语言模型、Rust 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:cargo install(推荐) cargo install red-candle # 方式二:从源码编译 git clone https://github.com/scientist-labs/red-candle cd red-candle cargo build --release # 二进制在 ./target/release/red-candle
# 查看帮助 red-candle --help # 基本运行 red-candle [options] <input> # 详细使用说明请查阅文档 # https://github.com/scientist-labs/red-candle
# red-candle 配置说明 # 查看配置选项 red-candle --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export RED_CANDLE_CONFIG="/path/to/config.yml"
<img src="/docs/assets/logo-title.png" alt="red-candle" height="160px">
Run state-of-the-art language models directly from Ruby. No Python, no APIs, no external services - just Ruby with blazing-fast Rust under the hood. Hardware accelerated with Metal (Mac) and CUDA (NVIDIA). Red candle leverages the Rust ecosystem, notably Candle and Magnus, to provide a fast and efficient way to run LLMs in Ruby. See Dependencies for more.
ner = Candle::NER.from_pretrained("dslim/bert-base-NER", tokenizer: "bert-base-cased")
vlm = Candle::VLM.from_pretrained("llava-hf/llava-v1.6-vicuna-7b-hf")
```ruby require "candle"
x = Candle::Tensor.new([1, 2, 3, 4, 5, 6], :i64) x = x.reshape([3, 2])
The default model (jinaai/jina-embeddings-v2-base-en with the sentence-transformers/all-MiniLM-L6-v2 tokenizer, both from HuggingFace) takes a little more than 3GB of memory running on a Mac. The memory stays with the instantiated Candle::EmbeddingModel class, if you instantiate more than one, you'll use more memory. Likewise, if you let it go out of scope and call the garbage collector, you'll free the memory. For example:
```ruby > require 'candle'
```ruby require 'candle'
```ruby require 'candle'
```ruby require 'candle'
```ruby
padded_tokenizer = tokenizer.with_padding( length: 128, # Fixed length padding direction: "right", # Pad on the right (default) pad_token: "[PAD]" # Padding token ) ```
messages = [ { role: "user", content: "Explain Ruby in one sentence" } ]
puts llm.chat(messages)
messages = [ { role: "system", content: "You are a helpful assistant." }, { role: "user", content: "Explain Ruby in one sentence." } ] response = llm.chat(messages) ```
google/gemma-2b, google/gemma-7b, google/gemma-2b-it)TinyLlama/TinyLlama-1.1B-Chat-v1.0, meta-llama/Llama-2-7b-hf, NousResearch/Llama-2-7b-hf)mistralai/Mistral-7B-Instruct-v0.1)Qwen/Qwen2-1.5B, Qwen/Qwen2.5-7B-Instruct)microsoft/phi-2, microsoft/Phi-3-mini-4k-instruct, microsoft/phi-4)reset_cache parameter doesn't work for GGUF models. Recreate the model instance for each generation.candle pull request about phi-3 gguf models: https://github.com/huggingface/candle/pull/2937Red-Candle supports both BERT and XLM-RoBERTa reranker architectures. The model type is auto-detected from config.json.
| Model | Architecture | Params | Notes |
|---|---|---|---|
BAAI/bge-reranker-base | XLM-RoBERTa | 278M | Recommended — strong quality, multilingual |
BAAI/bge-reranker-large | XLM-RoBERTa | 560M | Best quality, higher resource usage |
BAAI/bge-reranker-v2-m3 | XLM-RoBERTa | 278M | Multilingual, very strong |
cross-encoder/ms-marco-MiniLM-L-12-v2 | BERT | 33M | Lightweight, English only |
All models expose their tokenizers:
```ruby
| Model | LLM Backend | Size | Notes |
|---|---|---|---|
llava-hf/llava-v1.6-vicuna-7b-hf | Llama (Vicuna) | 13GB | Recommended, LLaVA-Next with Llama backend |
cd ext/candle && cargo test
bundle exec rake rust:coverage:lcov
answer = vlm.ask("photo.jpg", "What animal is in this image?")
red-candle 是一个强大的 Ruby 库,旨在让开发者能够直接在 Ruby 环境中运行最先进的语言模型(Language Models)。无需依赖复杂的外部 API 调用,通过该项目,你可以将顶尖的 AI 能力无缝集成到你的 Ruby 应用中,实现本地化的模型推理。
在使用前,请确保模型格式符合要求。对于 English NER 任务,需要配合特定的 tokenizer 使用;若需��载 LLaVA 等视觉语言模型(VLM),首次运行时会自动从 HuggingFace 下载相关权重(例如 LLaVA 模型约需 13GB 空间),请确保网络环境稳定且磁盘空间充足。
安装过程非常简单,仅需 30 秒即可完成上手。你可以直接通过 RubyGems 安装该 gem:执行 `gem install red-candle` 即可。安装完成后,通过 `require 'candle'` 即可在你的 Ruby 项目中快速开启 AI 对话体验。
red-candle 提供了灵活的 Tensor 操作能力,支持对数据进行 reshape 等变换。需要注意的是,模型运行会占用一定的内存(例如在 Mac 上运行默认 Embedding 模型约需 3GB+)。请注意管理 `Candle::EmbeddingModel` 实例的生命周期,避免因重复实例化或对象未及时释放而导致内存溢出。
项目提供了高度可定制的 Tokenizer 配置功能。你可以通过 `with_padding` 方法灵活设置填充长度(length)、填充方向(direction,如 "right")以及指定的填充字符(pad_token),以满足不同 NLP 任务对输入序列格式的严格要求。
red-candle 支持完全本地化的 Chat 模式,无需通过网络 API 调用。你可以通过构造包含 `role`(如 "system" 或 "user")和 `content` 的消息数组,直接调用 `llm.chat` 方法进行对话。它能够完美模拟对话上下文,让你的 Ruby 程序具备智能助手般的交互能力。
red-candle 拥有广泛的模型支持生态,涵盖了 Google 的 Gemma 系列、Meta 的 Llama 2/3 系列以及 Mistral 等主流开源模型。此外,它还内置了对 BERT 和 XLM-RoBERTa 架构的 Reranker 支持,能够自动从 `config.json` 检测模型类型,并完美集成 HuggingFace 上的各类模型权重。
针对多模态需求,red-candle 支持通过 VLM 模型对图像进行提问。你可以直接调用 `vlm.ask` 方法,传入图片路径和你的问题(例如 "What animal is in this image?"),模型将直接返回对图像内容的理解与回答。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
经综合评估,红烛AI工具 在AI工具赛道中表现稳健,质量良好。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | red-candle |
| 原始描述 | 开源AI工具:Ruby gem for running state-of-the-art language models locally. Access LLMs, embe。⭐196 · Rust |
| Topics | AI语言模型Rust |
| GitHub | https://github.com/scientist-labs/red-candle |
| License | MIT |
| 语言 | Rust |
收录时间:2026-05-29 · 更新时间:2026-05-30 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。