Skip to content

Commit d9d75b5

Browse files
committed
add model info to specs
1 parent 1bf0adf commit d9d75b5

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ default-members = ["compute"]
99

1010
[workspace.package]
1111
edition = "2021"
12-
version = "0.2.32"
12+
version = "0.2.33"
1313
license = "Apache-2.0"
1414
readme = "README.md"
1515

compute/src/node.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ impl DriaComputeNode {
120120
(None, None)
121121
};
122122

123+
let model_names = config.workflows.get_model_names();
123124
Ok((
124125
DriaComputeNode {
125126
config,
@@ -134,7 +135,7 @@ impl DriaComputeNode {
134135
pending_tasks_batch: HashSet::new(),
135136
completed_tasks_single: 0,
136137
completed_tasks_batch: 0,
137-
spec_collector: SpecCollector::new(),
138+
spec_collector: SpecCollector::new(model_names),
138139
last_pinged_at: Instant::now(),
139140
},
140141
p2p_client,

compute/src/utils/specs.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,35 @@ pub struct Specs {
1717
os: String,
1818
/// CPU architecture, e.g. `x86_64`, `aarch64`.
1919
arch: String,
20-
// GPU adapter infos, showing information about the available GPUs.
21-
// gpus: Vec<wgpu::AdapterInfo>,
2220
/// Public IP lookup response.
2321
lookup: Option<LookupResponse>,
22+
/// Used models.
23+
models: Vec<String>,
24+
// GPU adapter infos, showing information about the available GPUs.
25+
// gpus: Vec<wgpu::AdapterInfo>,
2426
}
2527

2628
pub struct SpecCollector {
2729
/// System information object, this is expected to be created only once
2830
/// as per the [docs](https://github.com/GuillaumeGomez/sysinfo?tab=readme-ov-file#good-practice--performance-tips).
2931
system: sysinfo::System,
32+
/// Used models.
33+
models: Vec<String>,
3034
// GPU adapter infos, showing information about the available GPUs.
3135
// gpus: Vec<wgpu::AdapterInfo>,
3236
}
3337

3438
impl Default for SpecCollector {
3539
fn default() -> Self {
36-
Self::new()
40+
Self::new(vec![])
3741
}
3842
}
3943

4044
impl SpecCollector {
41-
pub fn new() -> Self {
45+
pub fn new(models: Vec<String>) -> Self {
4246
SpecCollector {
4347
system: sysinfo::System::new_with_specifics(Self::get_refresh_specifics()),
48+
models,
4449
// gpus: wgpu::Instance::default()
4550
// .enumerate_adapters(wgpu::Backends::all())
4651
// .into_iter()
@@ -68,8 +73,9 @@ impl SpecCollector {
6873
cpu_usage: self.system.global_cpu_usage(),
6974
os: std::env::consts::OS.to_string(),
7075
arch: std::env::consts::ARCH.to_string(),
71-
// gpus: self.gpus.clone(),
7276
lookup: public_ip_address::perform_lookup(None).await.ok(),
77+
models: self.models.clone(),
78+
// gpus: self.gpus.clone(),
7379
}
7480
}
7581
}
@@ -80,7 +86,7 @@ mod tests {
8086
#[tokio::test]
8187
#[ignore = "run manually"]
8288
async fn test_print_specs() {
83-
let mut spec_collector = SpecCollector::new();
89+
let mut spec_collector = SpecCollector::new(vec!["gpt-4o".to_string()]);
8490
let specs = spec_collector.collect().await;
8591
println!("{}", serde_json::to_string_pretty(&specs).unwrap());
8692
}

workflows/src/config.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ impl DriaWorkflowsConfig {
180180
}
181181

182182
/// Returns the list of unique providers in the config.
183+
#[inline]
183184
pub fn get_providers(&self) -> Vec<ModelProvider> {
184185
self.models
185186
.iter()
@@ -191,6 +192,15 @@ impl DriaWorkflowsConfig {
191192
})
192193
}
193194

195+
/// Returns the list of all models in the config.
196+
#[inline]
197+
pub fn get_model_names(&self) -> Vec<String> {
198+
self.models
199+
.iter()
200+
.map(|(_, model)| model.to_string())
201+
.collect()
202+
}
203+
194204
/// Check if the required compute services are running.
195205
/// This has several steps:
196206
///

0 commit comments

Comments
 (0)