Skip to content

Serve Model Azure Functions How-To#12012

Merged
luisquintanilla merged 8 commits intodotnet:masterfrom
luisquintanilla:build2019/1484868
Apr 29, 2019
Merged

Serve Model Azure Functions How-To#12012
luisquintanilla merged 8 commits intodotnet:masterfrom
luisquintanilla:build2019/1484868

Conversation

@luisquintanilla
Copy link
Copy Markdown
Contributor

@luisquintanilla luisquintanilla commented Apr 24, 2019

Serve Model Azure Functions How-To

Internal Review URL

#AB1484868

@luisquintanilla luisquintanilla changed the title [WIP] Serve Model Azure Functions How-To Serve Model Azure Functions How-To Apr 25, 2019
Copy link
Copy Markdown
Contributor

@JRAlexander JRAlexander left a comment

Choose a reason for hiding this comment

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

LGTM!

@natke
Copy link
Copy Markdown
Contributor

natke commented Apr 26, 2019

Make sure it is clear that these are alternatives

Pre-trained model.
- Use the ML.NET Sentiment Analysis tutorial to build your own model or (<-- or similar)
- Download this [pre-trained sentiment analysis machine learning model]

@natke
Copy link
Copy Markdown
Contributor

natke commented Apr 26, 2019

This is a real nit but can we indent the code samples to align with the numbered list. I think this would increase readability

Copy link
Copy Markdown
Contributor

@natke natke left a comment

Choose a reason for hiding this comment

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

LGTM. A couple of minor comments

@luisquintanilla luisquintanilla changed the base branch from master to staging April 29, 2019 22:48
@luisquintanilla luisquintanilla changed the base branch from staging to master April 29, 2019 22:49
@luisquintanilla luisquintanilla merged commit 64d154d into dotnet:master Apr 29, 2019
@CESARDELATORRE
Copy link
Copy Markdown
Contributor

This is wrong doing that on a static object because the PredictionEngine is not threadsafe.
_predictionEngine = _mlContext.Model.CreatePredictionEngine<SentimentData, SentimentPrediction>(_model);

@CESARDELATORRE
Copy link
Copy Markdown
Contributor

You could probably use a static PredictionEnginePool because the pool is thread-safe.
Similar to how we use it in ASP.NET Core but without using dependency injection.

But I would really prefer to use dependency injection in the Azure Function in a similar way it is explained in this blog post:

https://blog.wille-zone.de/post/azure-functions-dependency-injection/

Then, the implementation using PredictionEnginePool would be very similar to the one recommended in ASP.NET Core WebAPI or apps.

BillWagner pushed a commit to BillWagner/docs that referenced this pull request May 6, 2019
* Merge pull request dotnet#12012 from luisquintanilla/build2019/1484868

Serve Model Azure Functions How-To

* Updated with PredictionEnginePool and new model

* Updated titles & predictionenginepool description

* Updated from data classes to data models

* Updates to formatting

* Updated based on feedback
@luisquintanilla luisquintanilla deleted the build2019/1484868 branch July 31, 2019 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants