dotnet / dotnet/machinelearning

how to use gpu? AddPredictionEnginePool

Open
#5,985 2 comments 0 reactions 0 assignees View on GitHub
area-Integration documentation
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

**System Information (please complete the following information):**
- OS & Version: ubuntu 20.04
- ML.NET Version: 1.6.0
- .NET Version: .net core 3.1
- Microsoft.Extensions.ML version: 1.6.0
- webapi

**Describe the bug**
cpu work well, but, how to use gpu?

**Screenshots, Code, Sample Projects**

Startup.cs:
```
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddPredictionEnginePool().FromFile("./mlmodel/denoise_docs.zip");
}
```

Controller:
```
public class DocsController : Controller
{
private readonly PredictionEnginePool _denoiseEngine;

public DocsController(PredictionEnginePool denoiseEngine)
{
_denoiseEngine = denoiseEngine;
}

public ActionResult DeNoise([FromBody] DeNoiseRequest request)
{
...
var outs = _denoiseEngine.Predict(imgExample);
...
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.