diff --git a/samples/cs/native-chat-completions/Program.cs b/samples/cs/native-chat-completions/Program.cs index d1527503..033786b1 100644 --- a/samples/cs/native-chat-completions/Program.cs +++ b/samples/cs/native-chat-completions/Program.cs @@ -21,19 +21,22 @@ // Discover available execution providers and their registration status. var eps = mgr.DiscoverEps(); +int maxNameLen = 30; Console.WriteLine("Available execution providers:"); +Console.WriteLine($" {"Name".PadRight(maxNameLen)} Registered"); +Console.WriteLine($" {new string('─', maxNameLen)} {"──────────"}"); foreach (var ep in eps) { - Console.WriteLine($" {ep.Name} (registered: {ep.IsRegistered})"); + Console.WriteLine($" {ep.Name.PadRight(maxNameLen)} {ep.IsRegistered}"); } // Download and register all execution providers with per-EP progress. // EP packages include dependencies and may be large. // Download is only required again if a new version of the EP is released. // For cross platform builds there is no dynamic EP download and this will return immediately. +Console.WriteLine("\nDownloading execution providers:"); if (eps.Length > 0) { - int maxNameLen = eps.Max(e => e.Name.Length); string currentEp = ""; await mgr.DownloadAndRegisterEpsAsync((epName, percent) => { @@ -46,11 +49,8 @@ await mgr.DownloadAndRegisterEpsAsync((epName, percent) => currentEp = epName; } Console.Write($"\r {epName.PadRight(maxNameLen)} {percent,6:F1}%"); - if (percent >= 100) - { - Console.WriteLine(); - } }); + Console.WriteLine(); } else { diff --git a/samples/js/native-chat-completions/app.js b/samples/js/native-chat-completions/app.js index 4246f64f..9e34c90f 100644 --- a/samples/js/native-chat-completions/app.js +++ b/samples/js/native-chat-completions/app.js @@ -16,16 +16,19 @@ console.log('✓ SDK initialized successfully'); // Discover available execution providers and their registration status. const eps = manager.discoverEps(); +const maxNameLen = 30; console.log('\nAvailable execution providers:'); +console.log(` ${'Name'.padEnd(maxNameLen)} Registered`); +console.log(` ${'─'.repeat(maxNameLen)} ──────────`); for (const ep of eps) { - console.log(` ${ep.name} (registered: ${ep.isRegistered})`); + console.log(` ${ep.name.padEnd(maxNameLen)} ${ep.isRegistered}`); } // Download and register all execution providers with per-EP progress. // EP packages include dependencies and may be large. // Download is only required again if a new version of the EP is released. +console.log('\nDownloading execution providers:'); if (eps.length > 0) { - const maxNameLen = Math.max(...eps.map(e => e.name.length)); let currentEp = ''; await manager.downloadAndRegisterEps((epName, percent) => { if (epName !== currentEp) { @@ -35,10 +38,8 @@ if (eps.length > 0) { currentEp = epName; } process.stdout.write(`\r ${epName.padEnd(maxNameLen)} ${percent.toFixed(1).padStart(5)}%`); - if (percent >= 100) { - process.stdout.write('\n'); - } }); + process.stdout.write('\n'); } else { console.log('No execution providers to download.'); } diff --git a/sdk/cs/README.md b/sdk/cs/README.md index 26287217..3efdc242 100644 --- a/sdk/cs/README.md +++ b/sdk/cs/README.md @@ -94,11 +94,8 @@ await mgr.DownloadAndRegisterEpsAsync((epName, percent) => currentEp = epName; } Console.Write($"\r {epName} {percent,6:F1}%"); - if (percent >= 100) - { - Console.WriteLine(); - } }); +Console.WriteLine(); ``` Catalog access no longer blocks on EP downloads. Call `DownloadAndRegisterEpsAsync` explicitly when you need hardware-accelerated execution providers. diff --git a/sdk/js/README.md b/sdk/js/README.md index 5590ab12..c197e80e 100644 --- a/sdk/js/README.md +++ b/sdk/js/README.md @@ -67,10 +67,8 @@ await manager.downloadAndRegisterEps((epName, percent) => { currentEp = epName; } process.stdout.write(`\r ${epName} ${percent.toFixed(1)}%`); - if (percent >= 100) { - process.stdout.write('\n'); - } }); +process.stdout.write('\n'); ``` Catalog access does not block on EP downloads. Call `downloadAndRegisterEps()` when you need hardware-accelerated execution providers. diff --git a/sdk/python/README.md b/sdk/python/README.md index 4ee1f9cc..3ff677d2 100644 --- a/sdk/python/README.md +++ b/sdk/python/README.md @@ -102,10 +102,9 @@ def on_progress(ep_name: str, percent: float) -> None: print() current_ep = ep_name print(f"\r {ep_name} {percent:5.1f}%", end="", flush=True) - if percent >= 100: - print() manager.download_and_register_eps(progress_callback=on_progress) +print() ``` Catalog access does not block on EP downloads. Call `download_and_register_eps()` when you need hardware-accelerated execution providers. diff --git a/sdk/rust/README.md b/sdk/rust/README.md index 6bcb9884..d3983430 100644 --- a/sdk/rust/README.md +++ b/sdk/rust/README.md @@ -102,10 +102,8 @@ manager.download_and_register_eps_with_progress(None, move |ep_name: &str, perce *current = ep_name.to_string(); } print!("\r {} {:5.1}%", ep_name, percent); - if percent >= 100.0 { - println!(); - } }).await?; +println!(); ``` Catalog access does not block on EP downloads. Call `download_and_register_eps` when you need hardware-accelerated execution providers.