Skip to content

Commit 954fffb

Browse files
committed
update model selections
1 parent cdbf572 commit 954fffb

File tree

9 files changed

+468
-250
lines changed

9 files changed

+468
-250
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "dkn-compute-launcher"
33
edition = "2021"
4-
version = "0.1.18"
4+
version = "0.1.19"
55
license = "Apache-2.0"
66
readme = "README.md"
77
description = "Dria Compute Node Launcher"
@@ -66,3 +66,4 @@ features = ["vendored"]
6666
# clippy overrides
6767
[lints.clippy]
6868
nonminimal_bool = "allow"
69+
uninlined_format_args = "allow"

README.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The **Dria Compute Launcher** is a simple and efficient way to set up and run th
3333

3434
It is packed with many features:
3535

36-
- [x] **Settings Menu**: You can change various settings such as your wallet, ports and API keys, all without leaving the launcher. You can also open a raw text-editor in terminal.
36+
- [x] **Settings Menu**: You can change all settings such as your wallet, all without leaving the launcher. You can also open a raw text-editor in terminal.
3737
- [x] **Model Selection**: You can choose your models with a nice menu.
3838
- [x] **Model Benchmarking**: You can measure TPS for Ollama models to see if your machine can handle them.
3939
- [x] **Automatic Updates**: Launcher will automatically update a running compute node when there is an update & restart it; furthermore, it will update itself when there is a new launcher as well!
@@ -110,11 +110,9 @@ dkn-compute-launcher <some-command> --help
110110
111111
### Model Providers
112112

113-
The purpose of running a Dria Compute Node is to serve LLMs to the network. These models can either be locally-hosted models via Ollama, or API-based models such as Gemini and OpenAI.
113+
The purpose of running a Dria Compute Node is to serve LLMs to the network. These models can either be locally-hosted models via Ollama, and more local-model providers in the future!
114114

115-
- To serve API-based models ([OpenAI](https://openai.com/), [Gemini](https://gemini.google.com/app), [OpenRouter](https://openrouter.ai/)), you will need to get their API keys.
116-
117-
- To serve a locally-hosted model with [Ollama](https://ollama.com/), you of course need Ollama installed, and you must make sure that your machine can handle your chosen models. See ["Measuring Local Models"](#measuring-local-models) chapter below to see the command-line tools that help you measure TPS.
115+
- To serve a locally-hosted model with [Ollama](https://ollama.com/), you need Ollama installed, and you must make sure that your machine can handle your chosen models. See ["Measuring Local Models"](#measuring-local-models) chapter below to see the command-line tools that help you measure TPS.
118116

119117
### Starting a Node
120118

@@ -160,7 +158,6 @@ You will be greeted with a menu, where you can navigate with arrow keys <kbd>↑
160158
Port
161159
Models
162160
Ollama
163-
API Keys
164161
Log Levels
165162
✓ Save & Exit
166163
✗ Abort Changes
@@ -172,7 +169,6 @@ Using this menu, you are able to change the following settings:
172169
- **Port**: edit your listen address port, defaults to `4001`
173170
- **Models**: view all models & edit the models that you want to serve
174171
- **Ollama**: edit host & port of the Ollama server
175-
- **API Keys**: change API keys for providers
176172
- **Log Levels**: change log-levels for modules within compute node & launcher
177173

178174
Within a menu, you can go back by selecting <kbd>← Go Back</kbd>. Within the main menu, you can select <kbd>✓ Save & Exit</kbd> to save your changes & write them to the environment file, or you can choose <kbd>✗ Abort Changes</kbd> to abort all changes.
@@ -200,13 +196,10 @@ Click on `Edit model selection` to select models for your node.
200196
```sh
201197
? Select a model provider:
202198
> ollama
203-
openai
204-
gemini
205-
openrouter
206199
← Go Back
207200
```
208201

209-
Here, you can select a provider to choose models served by them, where you will be greeted with the following menu:
202+
Here, you can select a provider (currently Ollama alone) to choose models served by them, where you will be greeted with the following menu:
210203

211204
```sh
212205
> Select a model provider: ollama

src/commands/settings.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ pub async fn change_settings(env_path: &Path) -> eyre::Result<()> {
5858
Settings::Ollama => {
5959
crate::settings::edit_ollama(&mut dria_env)?;
6060
}
61-
Settings::ApiKeys => {
62-
crate::settings::edit_api_keys(&mut dria_env)?;
63-
}
61+
// Settings::ApiKeys => {
62+
// crate::settings::edit_api_keys(&mut dria_env)?;
63+
// }
6464
Settings::LogLevels => {
6565
crate::settings::edit_log_level(&mut dria_env)?;
6666
}

src/commands/start.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use dkn_executor::{ollama_rs::Ollama, ModelProvider};
22
use eyre::{Context, Result};
3-
use std::{collections::HashSet, env, path::Path};
3+
use std::{env, path::Path};
44
use tokio::process::Command;
55
use tokio_util::sync::CancellationToken;
66

77
use crate::{
8-
settings::{self, DriaApiKeyKind},
8+
settings,
99
utils::{
1010
check_ollama, configure_fdlimit, pull_model_with_progress, spawn_ollama, ComputeInstance,
1111
},
@@ -63,17 +63,17 @@ pub async fn run_compute_node(
6363
dria_env.ask_for_key_if_required()?;
6464

6565
// check API keys for the providers that are used with the selected models
66-
let providers = models
67-
.iter()
68-
.map(|model| model.provider())
69-
.collect::<HashSet<_>>();
70-
for api_key in DriaApiKeyKind::from_providers(providers.into_iter()) {
71-
if dria_env.get(api_key.name()).is_none() {
72-
log::info!("Provide {} because you are using its model", api_key);
73-
let new_value = api_key.prompt_api(&dria_env)?;
74-
dria_env.set(api_key.name(), new_value);
75-
}
76-
}
66+
// let providers = models
67+
// .iter()
68+
// .map(|model| model.provider())
69+
// .collect::<HashSet<_>>();
70+
// for api_key in DriaApiKeyKind::from_providers(providers.into_iter()) {
71+
// if dria_env.get(api_key.name()).is_none() {
72+
// log::info!("Provide {} because you are using its model", api_key);
73+
// let new_value = api_key.prompt_api(&dria_env)?;
74+
// dria_env.set(api_key.name(), new_value);
75+
// }
76+
// }
7777

7878
// check if Ollama is required & running, and run it if not
7979
let ollama_models = models

src/settings/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ mod models;
44
pub use models::edit_models; // used by `setup` command
55
pub use models::show_model_settings_menu;
66

7-
mod apikey;
8-
pub use apikey::{edit_api_keys, DriaApiKeyKind};
7+
// TODO: we no longer have an API key requirement
8+
// mod apikey;
9+
// pub use apikey::{edit_api_keys, DriaApiKeyKind};
910

1011
mod wallet;
1112
pub use wallet::edit_wallet;
@@ -30,8 +31,8 @@ pub enum Settings {
3031
Models,
3132
/// Configure Ollama settings.
3233
Ollama,
33-
/// Configure your API Keys.
34-
ApiKeys,
34+
// Configure your API Keys.
35+
// ApiKeys,
3536
/// Configure log-levels.
3637
LogLevels,
3738
/// Quit settings menu.
@@ -54,7 +55,7 @@ impl std::fmt::Display for Settings {
5455
Self::Port => write!(f, "Port"),
5556
Self::Models => write!(f, "Models"),
5657
Self::Ollama => write!(f, "Ollama"),
57-
Self::ApiKeys => write!(f, "API Keys"),
58+
// Self::ApiKeys => write!(f, "API Keys"),
5859
Self::LogLevels => write!(f, "Log Levels"),
5960
Self::SaveExit => write!(f, "{}", "✓ Save & Exit".bold().green()),
6061
Self::Abort => write!(f, "{}", "✗ Abort Changes".bold().red()),

src/utils/fdlimit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ pub fn configure_fdlimit() {
3434

3535
// only do this if soft-limit is below the target
3636
if soft < target_soft {
37-
if let Err(e) = rlimit::Resource::NOFILE.set(target_soft, hard) {
38-
log::error!("Failed to set file-descriptor limits: {}, you may need to run as administrator!", e);
37+
if let Err(err) = rlimit::Resource::NOFILE.set(target_soft, hard) {
38+
log::error!("Failed to set file-descriptor limits: {err}, you may need to run as administrator!");
3939
} else {
4040
log::warn!("Using new resource limits (soft / hard): {target_soft} / {hard}");
4141
}

src/utils/process.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ impl ComputeInstance {
8181
_ = compute_node_update_interval.tick() => {
8282
if !self.check_updates { continue; }
8383

84-
if let Err(e) = self.handle_compute_update().await {
85-
log::error!("Error updating compute node: {}", e);
84+
if let Err(err) = self.handle_compute_update().await {
85+
log::error!("Error updating compute node: {err}");
8686
}
8787
},
8888
// launcher self-update checks
8989
_ = launcher_update_interval.tick() => {
9090
if !self.check_updates { continue; }
9191

92-
if let Err(e) = self.handle_launcher_update().await {
93-
log::error!("Error updating launcher: {}", e);
92+
if let Err(err) = self.handle_launcher_update().await {
93+
log::error!("Error updating launcher: {err}");
9494
}
9595
},
9696
}

src/utils/selectable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ where
6363
impl<T: Display> Display for Selectable<T> {
6464
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6565
match self {
66-
Self::Some(ref value) => write!(f, "{}", value),
66+
Self::Some(ref value) => write!(f, "{value}"),
6767
Self::None => write!(f, "{}", DESELECT_MSG.bold()),
6868
}
6969
}

0 commit comments

Comments
 (0)