Skip to main content

Crate ferrum_models

Crate ferrum_models 

Source
Expand description

Ferrum 模型层

该 crate 负责围绕 ferrum-interfaces/ferrum-types 定义的核心抽象 提供模型定义解析、构建器与权重加载占位实现,确保上层可以在 重构阶段编译。

Re-exports§

pub use architectures::BertModelWrapper;
pub use architectures::ClipModelWrapper;
pub use architectures::LlamaModelWrapper;
pub use architectures::Qwen2ModelWrapper;
pub use architectures::Qwen3ModelWrapper;
pub use builder::DefaultModelBuilderFactory;
pub use builder::SimpleModelBuilder;
pub use definition::ConfigManager;
pub use definition::ModelDefinition;
pub use executor::BertModelExecutor;
pub use executor::CandleModelExecutor;
pub use executor::ClipModelExecutor;
pub use executor::Qwen2ModelExecutor;
pub use executor::Qwen3ModelExecutor;
pub use executor::StubModelExecutor;
pub use hf_download::HfDownloader;
pub use image_processor::ClipImageProcessor;
pub use loader::SafeTensorsLoader;
pub use registry::Architecture;
pub use registry::DefaultModelRegistry;
pub use registry::ModelAlias;
pub use registry::ModelDiscoveryEntry;
pub use registry::ModelFormatType;
pub use source::DefaultModelSourceResolver;
pub use source::ModelFormat;
pub use source::ModelSourceConfig;
pub use source::ModelSourceResolver;
pub use source::ResolvedModelSource;
pub use tensor_wrapper::CandleTensorWrapper;
pub use tokenizer::TokenizerFactory;
pub use tokenizer::TokenizerHandle;
pub use weights::default_weight_loader;
pub use weights::StubWeightLoader;
pub use weights::WeightLoaderHandle;

Modules§

architectures
Model architecture implementations
builder
Builder 模块:提供默认构建器工厂与占位实现
definition
Model definition and configuration parsing
executor
Model executor implementations
hf_download
HuggingFace model downloader with proxy and resume support
image_processor
Image preprocessing for CLIP models.
loader
Weight loading from SafeTensors files
registry
Model registry and alias management
source
Model source resolution and downloading with progress tracking
tensor_wrapper
Candle Tensor wrapper implementing TensorLike
tokenizer
Tokenizer 占位实现
weights
Weight loading - MVP stub implementation

Structs§

AttentionConfig
Attention configuration for model architecture
ModelConfig
Model configuration for runtime
ModelInfo
Model information and metadata
RopeScaling
RoPE (Rotary Position Embedding) scaling configuration

Enums§

Activation
Activation function type
ModelType
Model type enumeration
NormType
Normalization type used in the model

Traits§

ModelBuilder
Model builder for constructing model executors
ModelExecutor
Core model executor trait focusing on tensor operations
WeightLoader
Weight loading interface for model parameter management

Type Aliases§

Result
Result type used throughout Ferrum