Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

petals models local support using python env #435

Merged
merged 62 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
d8f2865
added support for swarm mode
filopedraz Sep 1, 2023
edd104d
stable petals release fixed version
filopedraz Sep 6, 2023
88f68fd
Fix style + add PETALS tag
Janaka-Steph Sep 19, 2023
9e5a6b7
updated small fix readme
filopedraz Oct 9, 2023
e44f024
show swarm mode only on macos
nsosio Oct 10, 2023
c1bdb32
added num_blocks parameter; start petals does not work
nsosio Oct 10, 2023
45fdfb7
clean up
nsosio Oct 10, 2023
4ac0c78
bugfix
nsosio Oct 10, 2023
e08099b
added hardcoded model selection
nsosio Oct 10, 2023
178a104
added model selection
nsosio Oct 11, 2023
2a83115
added username from whomai (with prem-app as fallback)
nsosio Oct 11, 2023
1a025a2
removed max val for num blocks
nsosio Oct 12, 2023
a2ac4c2
build fixed
nsosio Oct 12, 2023
b328aa6
added public name parameter (default prem-app)
nsosio Oct 13, 2023
a5b8f45
moved petals swarm to sidecar
nsosio Oct 13, 2023
375b81e
fix: supports Apple Silicon and little UI tweaks
tiero Oct 16, 2023
b65ef35
moved petals sidecar script to scripts; bugfix in SwarmMode
nsosio Oct 16, 2023
8a18a05
added get_username tauri command
nsosio Oct 17, 2023
8275a12
added swarm-mode only for aarch64
nsosio Oct 17, 2023
8a2667c
renamed petals binary from petals-aarch64-apple-darwin to petals-univ…
nsosio Oct 18, 2023
52ae6a4
CI: workflow tidy
casperdcl Oct 18, 2023
86f1e8a
build_petals: parameterise for arches
casperdcl Oct 18, 2023
7e7ffe9
moving swarm mode from sidecar to miniconda env
nsosio Oct 20, 2023
0db39e1
bugfix in swarm command
nsosio Oct 23, 2023
25c7993
removed sidecar
nsosio Oct 23, 2023
50ece5a
added env deletion script
nsosio Oct 24, 2023
2936bd6
Async run_swarm_mode
nsosio Oct 24, 2023
0a76cbf
added spinner while creating the environment
nsosio Oct 24, 2023
16aafc7
replaced wget with user wget
nsosio Oct 24, 2023
6f599ee
added fix for including path vars
nsosio Oct 25, 2023
3523919
tidy miniconda installation script
casperdcl Oct 25, 2023
a8e59d0
more tidy & use curl
casperdcl Oct 25, 2023
d0e2268
use miniforge, more tidy
casperdcl Oct 25, 2023
12bbaee
update delete_env script
casperdcl Oct 25, 2023
f672f63
fix exe perms
casperdcl Oct 25, 2023
84a5ca2
fixed script for conda env; swarm mode for linux and macos; added too…
nsosio Oct 25, 2023
a9b91dd
minor fixes
nsosio Oct 26, 2023
39adcf2
moved swarm commands to module
nsosio Oct 26, 2023
1ba943a
swarm persistent store draft
nsosio Oct 26, 2023
e2cd5ef
swarm persistent store bugfix
nsosio Oct 26, 2023
ab1edc2
removed shadow in swarm settings; addded label for swarm settings
nsosio Oct 26, 2023
ccb4311
added label on swarm environment creation
nsosio Oct 26, 2023
f8e31de
added clickable link for explorer
nsosio Oct 26, 2023
ad736e9
Merge branch 'main' into feat/swarm-mode-bash
tiero Oct 26, 2023
133ef04
Update src/shared/helpers/utils.ts
tiero Oct 27, 2023
c537f13
improve copy
tiero Oct 27, 2023
101f35a
updated conda processes filter
nsosio Oct 27, 2023
935f990
Merge branch 'copy-swarm' into feat/swarm-mode-bash
tiero Oct 27, 2023
a5be055
fmt
tiero Oct 27, 2023
9757244
add: petals models local support using python env
biswaroop1547 Oct 27, 2023
a2fb464
Merge branch 'main' into feat/petals-services-python
biswaroop1547 Oct 27, 2023
bf3bdab
fix: typo while resolving merge conflict
biswaroop1547 Oct 27, 2023
fa5ba46
Merge branch 'main' into feat/petals-services-python
biswaroop1547 Oct 31, 2023
395ff24
chore: removed todos
biswaroop1547 Oct 31, 2023
4715323
fix: lint
biswaroop1547 Oct 31, 2023
2ea9d5b
update: merge main branch
biswaroop1547 Nov 2, 2023
0e2223e
Merge branch 'main' of github.com:premAI-io/prem-app into feat/petals…
biswaroop1547 Nov 2, 2023
374ac43
Merge branch 'main' of github.com:premAI-io/prem-app into feat/petals…
biswaroop1547 Nov 3, 2023
47157d4
update: changes on create environment due to swarm mode changes
biswaroop1547 Nov 3, 2023
0a06db0
fix: lint
biswaroop1547 Nov 3, 2023
9fa393b
chore: use dev registry
tiero Nov 3, 2023
d726a72
Merge branch 'main' into feat/petals-services-python
filopedraz Nov 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src-tauri/src/controller_binaries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ use crate::{
download::Downloader,
err,
errors::{Context, Result},
logerr, Service, SharedState,
logerr,
swarm::{create_environment, Config},
Service, SharedState,
};

use std::path::PathBuf;
Expand Down Expand Up @@ -58,6 +60,7 @@ pub async fn download_service<R: Runtime>(

#[tauri::command(async)]
pub async fn start_service(
handle: tauri::AppHandle,
service_id: String,
state: State<'_, Arc<SharedState>>,
app_handle: AppHandle,
Expand Down Expand Up @@ -97,6 +100,11 @@ pub async fn start_service(
)
})?
.as_str();
let is_petals_model = services_guard
.get(&service_id)
.with_context(|| format!("service_id {} doesn't exist in registry", service_id))?
.petals
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe ok for now, but long-term would prefer serviceType=python

.unwrap_or_default();
log::info!("serve_command: {}", serve_command);
let serve_command_vec: Vec<&str> = serve_command.split_whitespace().collect();

Expand All @@ -123,9 +131,20 @@ pub async fn start_service(
})
.collect();
log::info!("args: {:?}", args);

let config = Config::new();
let mut env_vars = HashMap::new();
env_vars.insert("PREM_APPDIR".to_string(), config.app_data_dir);
env_vars.insert("PREM_PYTHON".to_string(), config.python);

if is_petals_model {
create_environment(handle);
}

let child = Command::new(&binary_path)
.current_dir(service_dir)
.args(args)
.envs(env_vars)
.stdout(std::process::Stdio::from(
log_file
.try_clone()
Expand Down
1 change: 1 addition & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pub struct Service {
running_port: Option<u32>,
#[serde(rename = "serviceType")]
service_type: Option<String>,
petals: Option<bool>,
version: Option<String>,
#[serde(rename = "weightsDirectoryUrl")]
weights_directory_url: Option<String>,
Expand Down
8 changes: 4 additions & 4 deletions src-tauri/src/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ pub fn is_swarm_supported() -> bool {
}
}

struct Config {
app_data_dir: String,
python: String,
pub struct Config {
pub app_data_dir: String,
pub python: String,
}

impl Config {
fn new() -> Self {
pub fn new() -> Self {
let mut app_data_dir =
tauri::api::path::home_dir().expect("🙈 Failed to get app data directory");
app_data_dir.push(".config/prem");
Expand Down