Helper to build a minimal Context for testing create_logits_processor.
(temperature: f64, top_k: Option<usize>, top_p: Option<f64>, seed: u64)
| 686 | |
| 687 | /// Helper to build a minimal Context for testing create_logits_processor. |
| 688 | fn make_test_context(temperature: f64, top_k: Option<usize>, top_p: Option<f64>, seed: u64) -> crate::cake::Context { |
| 689 | use crate::cake::{Context, Topology}; |
| 690 | use crate::Args; |
| 691 | use candle_core::DType; |
| 692 | use std::path::PathBuf; |
| 693 | use std::sync::{Arc, Mutex}; |
| 694 | |
| 695 | let args = Args { |
| 696 | temperature, |
| 697 | top_k, |
| 698 | top_p, |
| 699 | seed, |
| 700 | ..Args::default() |
| 701 | }; |
| 702 | |
| 703 | Context { |
| 704 | args, |
| 705 | dtype: DType::F32, |
| 706 | topology: Topology::new(), |
| 707 | data_path: PathBuf::from("/tmp"), |
| 708 | device: Device::Cpu, |
| 709 | config: None, |
| 710 | cache: None, |
| 711 | var_builder: None, |
| 712 | text_model_arch: crate::TextModelArch::Llama, |
| 713 | quant: Arc::new(crate::utils::NoQuantization), |
| 714 | listener_override: Arc::new(Mutex::new(None)), |
| 715 | tensor_storage: None, |
| 716 | layer_devices: None, |
| 717 | backend: Arc::new(crate::backends::CpuBackend::new()), |
| 718 | } |
| 719 | } |
| 720 | |
| 721 | #[test] |
| 722 | fn test_create_logits_processor_argmax_at_zero_temp() { |
no outgoing calls