Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hizkifw/pipa.net
Batching and parallelization helpers for C#/.NET
https://github.com/hizkifw/pipa.net
batching concurrency pipelining
Last synced: about 1 month ago
JSON representation
Batching and parallelization helpers for C#/.NET
- Host: GitHub
- URL: https://github.com/hizkifw/pipa.net
- Owner: hizkifw
- License: mit
- Created: 2024-07-30T08:08:07.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-01T06:59:26.000Z (5 months ago)
- Last Synced: 2024-11-01T17:11:30.668Z (about 2 months ago)
- Topics: batching, concurrency, pipelining
- Language: C#
- Homepage: https://www.nuget.org/packages/Pipa.NET
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pipa.NET
Batching and parallelization helper for .NET.
1. Construct a pipeline
```csharp
using Pipa.NET;await using var pipeline = PipelineBuilder.Create()
.Workers(4, pipe => pipe
.Step(async arg => await LoadImageFromPath(arg.Item))
.Step(async image => await CropImage(image, 128, 128)))
.Batch(batchSize: 16, maxWaitTime: TimeSpan.FromMilliseconds(100), pipe => pipe
.Step(async images => await GetImageEmbeddingsBatch(images))
.Step(async embeddings => await NormalizeEmbeddingsBatch(embeddings))
)
.Build();
```2. Call the pipeline. The input from multiple concurrent executions will be
batched and parallelized according to the pipeline configuration.```csharp
// Get a single embedding from a single image path
var normalizedEmbeddings = await pipeline.ExecuteAsync(imagePath);
```3. Dispose of the pipeline when you're done using it, to free up resources and
stop background tasks.