use scirs2_core::ndarray::{Array, IxDyn};
use scirs2_neural::error::Result;
use scirs2_neural::layers::Layer;
use scirs2_neural::models::{BertConfig, BertModel};
fn main() -> Result<()> {
println!("BERT Model Example");
println!("==================");
println!("Creating a small BERT model...");
let config = BertConfig::custom(
1000, 32, 2, 4, );
let model = BertModel::<f32>::new(config)?;
let input = Array::from_shape_fn(IxDyn(&[2, 8]), |_| {
(scirs2_core::random::random::<f32>() * 100.0).floor()
});
println!("Input shape: {:?}", input.shape());
let sequence_output = model.forward(&input)?;
println!("Sequence output shape: {:?}", sequence_output.shape());
let pooled_output = model.get_pooled_output(&input)?;
println!("Pooled output shape: {:?}", pooled_output.shape());
println!("\nCreating a BERT-Base model...");
let _bert_base = BertModel::<f32>::bert_base_uncased()?;
let base_config = BertConfig::bert_base_uncased();
println!("BERT-Base model created successfully.");
println!(" - hidden size: {}", base_config.hidden_size);
println!(" - hidden layers: {}", base_config.num_hidden_layers);
println!(" - attention heads: {}", base_config.num_attention_heads);
println!("\nBERT example completed successfully!");
Ok(())
}