#MLNET – Fix the error [System. InvalidOperationException, Entry Point ‘ Not found] when you train a pipeline

Hi!

Today I’m going to leave this POST as a memory backup for me because I always forget to make this configuration in ML.Net projects and I always find the following error:

System.InvalidOperationException

  HResult=0x80131509

  Message=Entry point ‘<some external assembly> not found

  Source=Microsoft.ML.Data

Where [External Assembly] can be For example LightGBM

  Message=Entry point ‘Trainers.LightGbmClassifier’ not found

01 mlnet entry point not found

This error triggered when the app is running, at the beginning of a pipeline training. It is usually associated with scenarios where we add and use external references in addition to Microsoft.ML.

The solution is quite simple, we just have to make sure that the Project Property <CopyLocalLockFileAssemblies> this enabled

02 mlnet project config CopyLocalLockFileAssemblies

Editing the csproj file like this

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup Label="Globals">
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
  </PropertyGroup>
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>

And ready, now our pipelines can train properly!

Happy Coding!

Greetings @ Burlington

El Bruno

References

My Posts

Advertisements

#MLNET – Solución para el error [System.InvalidOperationException, Entry point ‘ not found] al momento de entrenar un Pipeline

Buenas!

Hoy voy a dejar este post como un ayuda memoria de algo que me olvido siempre en los proyectos de ML.Net y siempre me encuentro con el siguiente error.

System.InvalidOperationException

  HResult=0x80131509

  Message=Entry point ‘<some external assembly> not found

  Source=Microsoft.ML.Data

Donde el [External Assembly] puede ser por ejemplo LightGBM

  Message=Entry point ‘Trainers.LightGbmClassifier’ not found

01 mlnet entry point not found

Este error es de ejecución y se da al momento de comenzar el entrenamiento de un Pipeline. Suele estar asociado a escenarios donde agregamos una referencia externa además de Microsoft.ML.

La solución es bastante simple, solo debemos asegurarnos que la propiedad de proyecto <CopyLocalLockFileAssemblies> este habilitado

02 mlnet project config CopyLocalLockFileAssemblies

Editando el csproj de la siguiente manera

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup Label="Globals">
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
  </PropertyGroup>
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>

Y listo, ahora nuestros pipelines pueden entrenar correctamente!

Happy Coding!

Saludos @ Burlington

El Bruno

References

My Posts

#MLNet – Adding NuGet Packages in Preview mode from MyGet, ie: Microsoft.ML-0.6.0 Version

Hi!

A few days ago I wrote about the new Machine Learning.Net version 0,5. Yesterday when .NetConf started, the release was made official with the following post from Cesar de la Torre

Announcing ML.NET 0.5

Now, a detail that is a little Deep in the documentation is the way to access packages in preview mode that are used in the following repositories Machine Learning  and Machine Learning Samples

Well, when we open and try to compile one of the projects we can see that in the references of this are being used Packages in preview state

01 mlnet 0.60 preview solution explorer

The problem we have is that, when built, these packages are not available in nuget.org

Unable to find package Microsoft.ML with version (>= 0.6.0-preview-26912-3)

  – Found 5 version(s) in nuget.org [ Nearest version: 0.5.0 ]

 TensorFlowMLNETInceptionv3ModelScoring  

02 mlnet 060 preview error on build

The solution for this is to add the necessary packages in manual mode from MyGet.

PM> Install-Package Microsoft.ML -Version 0.6.0-preview-26913-1 -Source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json

or set up a new NuGet source in Visual Studio, with the following information

03 MyGet ML.Net Sources NuGet

In this way, when a NuGet Restore action is performed for example, when we build a project, and we will have all the necessary packages available to work.

04 mlnet 0.60 preview solution explorer build OK

Happy Coding!

Greetings @ Toronto

El Bruno

References

My Posts

#MLNet – Agregando paquetes en modo Preview desde MyGet, por ejemplo Microsoft.ML -Version 0.6.0

Buenas!

Hace unos días hable de la nueva version 0.5 de Machine Learning.Net. Ayer cuando comenzó .NetConf, se hizo oficial el lanzamiento de esta version con el siguiente post de Cesar de la Torre

Announcing ML.NET 0.5

Ahora bien, un detalle que está un poco Deep en la documentación es la forma de acceder a paquetes en modo Preview que se utilizan en los repositorios de Machine Learning  y en Machine Learning Samples

Pues bien, cuando abrimos e intentamos compilar uno de los proyectos podemos ver que en las referencias de este se están utilizando packages en modo Preview

01 mlnet 0.60 preview solution explorer

El problema que tenemos es que, al compilar, estos paquetes no están disponibles en nuget.org

Unable to find package Microsoft.ML with version (>= 0.6.0-preview-26912-3)

  – Found 5 version(s) in nuget.org [ Nearest version: 0.5.0 ]

 TensorFlowMLNETInceptionv3ModelScoring  

02 mlnet 060 preview error on build

La solución para esto es agregar los paquetes necesarios en modo manual desde MyGet.

PM> Install-Package Microsoft.ML -Version 0.6.0-preview-26913-1 -Source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json

O configurar un nuevo source de NuGet en Visual Studio, con la siguiente información

Name: Microsoft.ML

Source: https://dotnet.myget.org/F/dotnet-core/api/v3/index.json

03 MyGet ML.Net Sources NuGet

De esta manera, cuando se realice una acción de NuGet restore, por ejemplo, al compilar, tendremos disponibles todos los paquetes necesarios para trabajar.

04 mlnet 0.60 preview solution explorer build OK

Happy Coding!

Saludos @ Toronto

El Bruno

References

My Posts

#Tutorial – How to build an #Amazon #AlexaSkill using Visual Studio 2017, C# and #Azure (3 on N)

Hi !

In the previous post describe the steps necessary to create a WebSite that interacts with an Alexa Skill. The next step is to publish the website in Azure. There are many tutorials on how to do this, so I will not write the necessary steps (see references)

In my case I published my Alexa Skill Website in the following url

http://alexaskillbrunoevents.azurewebsites.net/

I1

It is important to remember the URL since it is the one that we will use in the configuration of our Skill.

Now it’s time to go back to the Amazon Developer Portal and edit the Skill we created in the 1st post. In the section [Configuration] we must define the location of the interaction endpoint, which in this case is our Azure WebApp

I2

Important: By default the url we got from Azure is a HTTP site, we should change this to HTTPS to be used in Amazon Alexa Skill.

The other values ​​in this section are left with their default values ​​and we go to the [SSL Certificate] section. In the case of Azure sites, they already have a certificate for safe navigation. We must select the 2nd option.

I3

And finally we get to the testing section [Test]. In it we can see, in JSON mode, the different messages that are sent from Alexa to our EndPoint. For example, if we invoke something simple like “help” we will have the following result

I4

If for example we invoke something more complicated than using Slots, we will see a different result. In this example, I ask Alexa for events about Hololens

I5

Well, this gives an idea about how to connect an Azure Api App to be the EndPoint of an Alexa Skill. In the following posts we will see more details on how to add extra functionality to the backend and how to use the new Alexa test environment.

Happy Coding!

Greetings @ Toronto

El Bruno

References

#Tutorial – Como crear un #Amazon #AlexaSkill con Visual Studio 2017, C# y #Azure (3 de N)

Buenas!

En el post anterior describir los pasos necesarios para crear un WebSite que interactúe con un Alexa Skill. El siguiente paso es publicar el mismo en Azure.  Hay muchos tutoriales sobre como hacer esto, así que no escribiré los pasos necesarios (ver referencias)

En mi caso he publicado el site en la siguiente url

http://alexaskillbrunoevents.azurewebsites.net/

I1

Es importante recordar la URL ya que es la que utilizaremos en la configuración de nuestro Skill.

Ahora es momento de abrir nuevamente el Amazon Developer Portal y editar el Skill que creamos en el 1er post. En la sección [Configuration] debemos definir la ubicación del endpoint de interaccion, que en este caso es nuestro site de Azure

I2

Importante: Por defecto la publicación se realiza con http, debemos cambiar el mismo por https.

Los demás valores de esta sección los dejamos con sus valores por defecto y pasamos a la sección [SSL Certificate]. En el caso de los sites en Azure, los mismos poseen ya un certificado para la navegación segura. Debemos seleccionar la 2da opción.

I3

Y finalmente llegamos a la sección de pruebas [Test]. En la misma podremos ver, en modo JSON, los diferentes mensajes que se envían desde Alexa a nuestro EndPoint. Por ejemplo, si invocamos algo simple como “help” tendremos el siguiente resultado

I4

Si por ejemplo invocamos algo mas complicado que utilice Slots, veremos un resultado diferente. En este ejemplo, le pregunto a Alexa por eventos sobre Hololens

I5

Pues bien, esto da una idea sobre como conectar un Azure Api App para que sea el EndPoint de un Alexa Skill. En los siguientes posts veremos mas detalles sobre como agregar funcionalidad extra al backend y sobre cómo utilizar el nuevo entorno de pruebas de Alexa.

Happy Coding!

Saludos @ Toronto

El Bruno

References

#Tutorial – How to build an #Amazon #AlexaSkill using Visual Studio 2017, C# and #Azure (2 on N)

Hi!

Well, in today’s post we will see how to create an Azure API App, which we will then use as an Alexa Skill backend that we created in the previous post.

Tommy describes in an excellent way how to create a website and prepare him to work with Alexa Skill in this post (link). This project uses the NuGet Package Alexa Skills Kit.
Net for the processing of messages with Amazon Alexa.

I have created a template for Visual Studio 2017 that can be downloaded from here (link) and that allows us to create a project already configured to work with Alexa Skills.

Note: the quick way to import this template is to copy the file [WebApi Alexa Skill.
zip] to the Visual Studio 2017 project directory. Usually in [% \ Documents \ Visual Studio 2017 \ Templates \ ProjectTemplates \ Visual C #]

We create a new project using the imported type.

I1.jpg

We compiled the project to refresh the NuGet references, update the NuGet packages and we can start working.

i2.jpg

The 2 main elements in the project are

  • Controllers / AlexaController.cs. This is an standard ApiController wchi will handle the Alexa requests. It uses 2 HTTP requests
    • HTTP GET mostly for testing
    • HTTP POST process Alexa requests with the class [AlexaResponseAsync]
  • Alexa / AlexaResponseAsync.cs. All the business logic is here.

So, in the Alexa Response class we will add some basic changes

  • Línea 7, change the message used on the skill activation event
  • Líneas 10 a 22, creates a message including the Intent name and the used slots.

Something similar to this

So far the creation of the web project. In the next post, we will see how to publish this website and connect it with the Alexa Skill.

Happy Coding!

Greetings @ Toronto

El Bruno

References

#Tutorial – Como crear un #Amazon #AlexaSkill con Visual Studio 2017, C# y #Azure (2 de N)

Buenas!

Pues bien, en el post de hoy veremos cómo crear un Azure API App, que luego utilizaremos como backend del Alexa Skill que hemos creado en el post anterior.

Tommy describe de una forma excelente como crear un website y prepararlo para trabajar con Alexa Skill en este post (link). Este proyecto utiliza el NuGet Package Alexa Skills Kit.Net para el procesado de los mensajes con Amazon Alexa.

Yo he creado una plantilla para Visual Studio 2017 que se puede descargar desde aquí (link) y que nos permite crear un proyecto ya configurado para trabajar con Alexa Skills.

Nota: la forma rápida de importar esta plantilla es copiar el archivo [WebApi Alexa Skill.zip] al directorio de proyectos de Visual Studio 2017. Usualmente en [%\Documents\Visual Studio 2017\Templates\ProjectTemplates\Visual C#]

Creamos un nuevo proyecto del tipo importado.

I1.jpg

Compilamos el proyecto para refrescar las referencias de NuGet, actualizamos los NuGet packages y ya podemos comenzar a trabajar.

i2.jpg

Los 2 elementos principales a trabajar son

  • Controllers / AlexaController.cs. Un ApiController standard que es el encargado de procesar las peticiones desde Alexa. Tiene 2 puntos de entrada
    • HTTP GET utilizado para pruebas
    • HTTP POST procesa las peticiones de Alexa utilizando [AlexaResponseAsync]
  • Alexa / AlexaResponseAsync.cs. Esta clase es la encargada de procesar los eventos de Alexa.

Es en esta ultima clase donde aplicaremos la mayoría de los cambios. Por ejemplo

  • Línea 7, cambiamos el mensaje que se retorna cuando se activa el Skill
  • Líneas 10 a 22, el mensaje que se retorna en cada Intent, retorna el nombre del Intent y si hay Slots, los slots utilizados en el mismo.

El código resultante es similar al siguiente

Hasta aquí la creación del proyecto web. En el próximo post, veremos como publicar este website y conectarlo con la Alexa Skill.

Happy Coding!

Saludos @ Toronto

El Bruno

References

#Bots – Error when you update the #NuGet package for System.IdentityModel.Tokens.Jwt on your #MicrosoftBot Application

Hello!

For a few days, I was lucky and go back to the great world of Microsoft Bot. In this one, my main task was to update one Bot I’ve created some time ago.

The update process is fairly simple. Gisela has written a post where he explains the biggest changes, and otherwise you can always browse ans learn from the Bot Framework source code on GitHub.

Now well, there is a stick ugly in the road that added to the 40 ° of fever I have figthed all the Sunday. When I begin to update the NuGet packages in my project, I find the following list (or similar depending on how you’ve used)

clipboard02

The easy path is to perform an “Update All” or follow an order similar to the following list.

  • Newtonsoft.Json
  • Microsoft.WindowsAzure.ConfigurationManager
  • Autofac
  • Microsoft.IdentityModel.Protocol.Extensions
  • Microsoft.Bot.Builder
  • System.IdentityModel.Tokens.Jwt

However, once updated all packages, our Bot will not work anymore and we’ll have a very descriptive error  “An error has ocurred.

clipboard03

The good thing about having the source code of the Bot Framework is after a while, is possible to understand there is a problem with System.IdentityModel.Tokens.Jwt version [5.0.0] . So, we need to make a “rollback” of the same to the version previous to bring our Bot back to life.

clipboard04

This solves the problem, and will have that see if I can put to see the code full so Bot Fwk works with the latest versions. For now, since it is a bit out of my reach; I’ve left a comment on the Issue reported on GitHub (link). As it is closed, if there is no response in a couple of days, I’ll see if I open a new Issue or I start to study about the topic 😀

Greetings @ Toronto

El Bruno

References

#Windows10 – Device Portal Wrapper available via NuGet and source code in #GitHub

Hello!

Some time ago I wrote about the Device Portal capabilities for Hololens. In my case, there are some key actions like remote monitoring, remote apps deploy and to device restart, which are very useful in my developer day to day.

Now is time to say thanks to the Windows Developer team. This is because, the “Windows Device Portal Wrapper” project is already is mature enough to be published on GitHub and as a Nuget package.

Let me deep into this project. The project provides a layer on top of the services REST on that is supports the Device Portal. This project is created in C# and you can use it from WPF or UWP apps.

The sample app included in the project, shows us how to connect to a remote device, and once connected perform some actions. For example, restart it or get device network information.

Clipboard01.png

Browsing a little bit more, I find some devices exposes services which are device specific, like Hololens or XBoxOne. For example, in the Device Portal API of Hololens (link), I find operations to start, stop or download a holographic recording.

clipboard02

The truth is that the time of launch is perfect, since there are 2-3 tasks that I believe that I can automate thanks to these APIs, and that saved me some time in the future.

Greetings @ Toronto

El Bruno

References