hey everyone in this video I'm going to walk through how to export a machine learning model from Microsoft Fabric and import that into Azure machine learning so we can publish that as a real-time inference endpoint and you might ask why do we need to do that um couldn't we just deploy that directly from fabric um and as of this recording which is um February in 2024 um currently fabric doesn't have the ability to deploy a model directly to an inference endpoint that is on Microsoft's um road map as of the this recording uh but currently
if we want to deploy a model we develop in fabric um is as an refer some point uh in in in as a web service we have to put it somewhere else but that's very easy to do so let's walk through that and see how we actually accomplish it so the first step is to go into fabric obviously and I'm going to choose the workspace where I have a model deployed so I have this one in urban Wheelworks which is a demo workspace that I use quite a bit and I have this model called customer
spend model it takes various inputs from uh customer demographics and predicts their customer spend the model's already been developed it was developed against fabric data um but now it's just a model and we can really use it from anywhere so we can see the input schema has an output schema and we're essentially going to redeploy this somewhere else since this was registered with mlflow um really all the metadata we need for the deployment is already here so we'll just go ahead and download the uh model version and that'll come into a a zip file in
my downloads folder so if I open that I can see all the ml flow metadata along with the ml model itself and these happen to be the same files that Azure ml needs in order to register a model in that service and from that service we can deploy it so I'm going to copy this out of the zip file so that it's on my file system and that looks good and then I'm I'm going to switch over to Azure ML and go into the machine Learning Studio for the workspace so I have a recent workspace
here that I'm I'm just going to deploy it here even though it's not related to this it'll it'll be good for a demo so let me go into that workspace and look at the models that I have and currently have three models registered in this workspace so I'm just going to register this new one as well and since I've downloaded it to my desktop I'm just going to upload it from there so I have to tell it it's an MLF flow um and I choose the folder this is a little unintuitive because you're choosing a
folder it looks like you're choosing files but you actually want to choose a folder and when you click upload you'll see the mlflow assets that that'll be uploaded then we need to give it a name uh this will be the registered name of the model in Azure ml so version one's fine um all this stuff is fine so I'll just click register and what this will do is upload these mlflow assets into Azure ml register them within the workspace and from here I can continue on as if I had to developed this model in Azure
ml it doesn't really matter so we're going to deploy that as a realtime endpoint um I'll just go with the default U compute uh instant count one to save me a little bit of money and I'll create a new new endpoint name let me give it a name that means something more to me so I'll just name it after the model's name basically this all looks fine deployment name okay so this is good so let's just go ahead and deploy that and then what's happening now is the compute is being created in the Azure infrastructure
the model will be loaded into the uh compute cluster which will only have one node so it's not really a cluster but it's it's a one node compute and I'm going to fast forward uh this takes you know 10 or 15 minutes to to run but I'll fast for the video so we don't have to watch all that so now that it's deployed let's just give it a quick test so we can see this U metadata came right in from the mlflow registration um we just basically we're passing in a data frame so we need
to hardcode values that it looks like um you know a list of columns and then one column of values we run that and this is kind of garbage in garbage out but I can see that it actually did call the model and um and It produced some output so I'm going to copy this data and let's now call it from outside the um the workspace so this is going to be from my desktop I'm going to use post to call the endpoint directly and it's going to be a post I have this body in my
clipboard right now so let me paste that in here before I lose it and we're just going to send the same payload from outside of azure and make sure it still works the consume here they give you you know essentially everything you need to put this into a uh the code for an application and we can use the the code maybe JavaScript is easier to read so here's the JavaScript version and we'll just copy and paste these values into Postman for our test so the content type we just pasted Json in the body so we
have to tell it that that's Json and then next do the authorization piece and we just we just need to pass in a bear token using the API key which was automatically generated when the endpoint was created so let's paste that in here and let's see what else are we missing it looks fine it's the content got content type we've got the security and the model name so we need to uh the endpoint can have multiple models deployed to it so we have to tell the uh the backend infrastructure which model we want to be
called here so we'll paste that in and I think we've got everything now so let's go ahead and send that and load we get the same values I think that we did before let's double check that so grab that payload again let's paste it back into the test and just confirm that the test inside and outside the workspace C does so that's pretty much it um I hope that was um useful and uh and I hope you learned something I will see you next time