Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions samples/cs/native-chat-completions/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
{
Expand All @@ -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
{
Expand Down
11 changes: 6 additions & 5 deletions samples/js/native-chat-completions/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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.');
}
Expand Down
5 changes: 1 addition & 4 deletions sdk/cs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions sdk/js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions sdk/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions sdk/rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading