mistralrs_core/xlora_models/
config.rs1use std::collections::HashMap;
2
3use either::Either;
4use serde::Deserialize;
5
6fn true_default() -> bool {
7 true
8}
9
10fn false_default() -> bool {
11 false
12}
13fn default_1() -> usize {
14 1
15}
16
17fn default_2048() -> usize {
18 1
19}
20fn default_dropout() -> f32 {
21 0.2
22}
23fn default_1f64() -> f64 {
24 1.0
25}
26fn default_0f64() -> f64 {
27 0.0
28}
29
30#[derive(Clone, Debug, Deserialize)]
31pub struct XLoraConfig {
32 pub hidden_size: usize,
33 pub base_model_id: String,
34 #[serde(rename = "adapters")]
35 #[serde(with = "either::serde_untagged")]
36 pub _adapters: Either<Vec<String>, HashMap<String, String>>,
37 #[serde(default = "false_default")]
38 pub layerwise_scalings: bool,
39 #[serde(default = "false_default")]
40 pub enable_relu_and_dropout: bool,
41 #[serde(default = "default_1")]
42 pub xlora_depth: usize,
43 #[serde(default = "default_2048")]
44 pub xlora_size: usize,
45 #[serde(default = "default_dropout")]
46 pub xlora_dropout_p: f32,
47 #[serde(default = "true_default")]
48 pub enable_softmax: bool,
49 #[serde(default = "default_1f64")]
50 pub softmax_temperature: f64,
51 #[serde(default = "default_0f64")]
52 pub scaling_pass_value: f64,
53 #[serde(default = "false_default", rename = "use_trainable_adapters")]
54 pub _use_trainable_adapters: bool,
55 #[serde(default = "true_default")]
56 pub use_bias: bool,
57 #[serde(default = "default_1f64")]
58 pub global_scaling_weight: f64,
59 pub top_k_lora: Option<usize>,
60 #[serde(default = "false_default")]
61 pub enable_softmax_topk: bool,
62}