#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 – Error ‘Entry point ‘Trainers.LightGbmClassifier’ not found’ and how to fix it

Hi!

Monday Tip hoping to save you some time if someone finds this error

I1

System.InvalidOperationException: ‘Entry point ‘Trainers.LightGbmClassifier’ not found’

Before going on, let me share a little context. In the current version of Machine Learning.Net [0.3.0] we have a couple of new Trainers. One of them is LightGBM. This Framework allows us to perform supervised sorting tasks in binary mode, multiple categories and more. In the MSDN blog post for the version 0.3.0 of ML.Net, this framework is well described, with also a very interesting definition

The definition for LightGBM in ‘Machine Learning lingo’ is: A high-performance gradient boosting framework based on decision tree algorithms.

Well after choosing a test data set which I know well, I decided to move on and try this new Trainer. Once I had created all the infrastructure necessary to use the Framework, I found the error I mentioned at the beginning of the post. And I didn’t like it at all. If you know a little bit of Windows, you know that type errors [Entry Point] never predict anything good.

Well, it was time to start investigating what was going on. I will not enumerate all the steps and tests I did, but only comment that I get to download and debug the source code of Machine Learning.Net. Although as usually happens in these cases, the solution was much simpler. Just look at the following lines of code

I2

You have to download a NuGet package to use LightBGM!

15 seconds later I had everything up and running to try the new Trainer!

I3

Happy Coding!

Greetings @ Toronto

El Bruno

References

My Posts

#MLNET – Error ‘Entry point ‘Trainers.LightGbmClassifier’ not found’ y como solucionarlo

Buenas!

Tip de lunes con la esperanza de ahorrarle un poco de tiempo si alguien se encuentra este error

I1

System.InvalidOperationException: ‘Entry point ‘Trainers.LightGbmClassifier’ not found’

Antes de seguir un poco de contexto. En la version actual de Machine Learning.Net [0.3.0] tenemos varios nuevos trainers y uno de ellos es LightGBM. Este framework nos permite realizar tareas supervisadas de clasificación en modo binario, multiples categorías y varias opciones mas. En el post de introducción a la version 0.3.0 de ML.Net se presenta el mismo, y además con una definición bastante interesante

The definition for LightGBM in ‘Machine Learning lingo’ is: A high-performance gradient boosting framework based on decision tree algorithms.

Pues bien, después de elegir un set de datos de prueba que conozco bastante bien, me decidi a probar este trainer. Una vez que hube creado toda la infraestructura necesaria para utilizar el framework, me encontré con el error que menciono al principio del post. Y no me gusto nada. Si conoces un poco de Windows, sabes que los errores de tipo [Entry point], nunca auguran nada bueno.

Pues bien, fue el momento de comenzar a investigar que pasaba. No voy a enumerar todos los pasos y pruebas que hice, pero solo comentare que llegue a descargar y depurar el source code de Machine Learning.Net. Aunque como suele suceder en estos casos, la solución era mucho más simple. Solo hay que ver las siguientes líneas de código

I2

Hay que descargar un paquete NuGet para utilizar LightBGM!

15 segundos después ya tenia todo up and running para probar el nuevo trainer!

I3

Happy Coding!

Greetings @ Toronto

El Bruno

References

My Posts

#DevOps – WebSites, Azure and Error: Multiple types were found that match the controller named ‘messages’.

Hi!

I’ll leave it written down in a post so I will not forget later. Let’s start with the context

  • We work with a web App. For example, a Microsoft Bot App with Visual Studio
  • The deployment of it is done to Azure as part of an automated process (DevOps rules!)
  • Everything works perfectly

Until in a moment you find that your Web App does not work anymore. And when you try to navigate one of the controllers, a message like the following may appear

Multiple types were found that match the controller named ‘messages’. This can happen if the route that services this request (‘api/{controller}/{id}’) found multiple controllers defined with the same name but differing namespaces …

There are several reasons why this usually happens. However, one of the most popular is that you have renamed or changed some namespaces and new Dlls have been generated as part of the solution. The problem is that, by default, and as a mechanism to save processing time, the deployments only copy the assemblies that have been modified to the destination location. In this case, to an IIS folder, so a mix of files is in the bin folder.

Before continuing I have to take up the words of the great  Damian Brady (@damovisa):

Friends don’t let friends right-click publish

The first time you have seen an option that allows you to clean the destination directory and then copy the compilation directory is in the Publish option of a website in Visual Studio 2017

I1

Well, if you have configured the publication of your website as part of a Build – Releases process, it is in this last section that you will find the option [Remove additional files at destination], which will eliminate the unnecessary Assemblies of your solution.

I2

Happy Coding!

Greetings @ Toronto

El Bruno

#DevOps – WebSites, Azure y multiples controllers. Error: Multiple types were found that match the controller named ‘messages’.

Buenas!

Lo voy a dejar apuntado en un post para que luego no me olvide. Comencemos por el contexto

  • Trabajamos con una App web. Por ejemplo, una Microsoft Bot App con Visual Studio
  • El despliegue de la misma se realiza a Azure como parte de un proceso automatizado (DevOps rules!)
  • Todo funciona perfectamente

Hasta que en un momento te encuentras que tu Web App no funciona más. Y cuando intentas navegar uno de los controllers, puede aparecer un mensaje como el siguiente

Multiple types were found that match the controller named ‘messages’. This can happen if the route that services this request (‘api/{controller}/{id}’) found multiple controllers defined with the same name but differing namespaces …

Hay varios motivos por los que suele suceder esto. Sin embargo uno de los mas populares es que has renombrado o cambiado algunos namespaces y se han generado nuevas Dlls como parte de la solución. El problema está en que, por defecto, y como mecanismo para ahorrar trabajo, los despliegues solo copian los ensamblados que se han modificado a la ubicación de destino. En este caso, a un folder de IIS.

Antes de seguir tengo que retomar las palabras del gran Damian Brady (@damovisa):

Friends don’t let friends right-click publish

La 1ra vez que has visto una opción que te permite limpiar el directorio de destino y luego copiar el directorio de compilación es en la opción Publish de un website en Visual Studio 2017

I1

Pues bien, si has configurado la publicación de tu website como parte de un proceso de Build – Releases, es en esta última sección donde encontraras la opción [Remove additional files at destination], que eliminara los Assemblies innecesarios de tu solución

I2

Happy Coding!

Saludos @ Burlington

El Bruno

#VS2017 – ASP.Net, IIS Express, #OneDrive and the error “The IIS Express applicationHost.config file contains invalid entries and must be corrected before you can open project”

Hi!

In recent months OneDrive has enabled a new feature that is great [Files On Demand]. If you have terabytes of information in OneDrive, this is a great way to optimize space and synchronization between multiple devices..

I1

Well, another feature that has OneDrive for a while is to automatically synchronize som of the information of your Windows Profile between different devices. For example, if you use 2 devices with the same OneDrive account, you can configure the account so that all the files that you have on your Desktop and in your Documents are synchronized between these devices.

I2

In my case, I usually develop on a PC with enough power and then I have my “crappy SurPro4” for demos and other sessions. I have enabled the option to synchronize the Desktops for a long time, and I think it will be a good idea to synchronize the also my Documents between this 2 machines.

Well, While I’m practicing a couple of sessions on Azure and Amazon Alexa I realized that when I opened a Web project on my Surface Pro 4 and when trying to load the same in Visual Studio 2017, I found this error

—————————

Microsoft Visual Studio

—————————

The IIS Express applicationHost.config file contains invalid entries and must be corrected before you can open project [$ProjectName].

Filename: redirection.config

Error: Cannot read configuration file

—————————

OK  

—————————

This got me on the nerves for a while, because the values in this file were correct. However, Visual Studio 2017 could not load ASP.Net projects. In a moment of lucidity, I realized that these files were not being loaded from [% USER_PATH] but from OneDrive

I3

And of course, it seems that IIS Express doesn’t get along with Onedrive. At this time the solution went through

  • Cancel the synchronization of the document folder
  • Configure my projects to use IIS instead of IIS Express

As the 2nd option is always much more practical at the time of work, I choose this one.  I’ve done this and everyone’s happy!

Happy Coding!

Greetings @ Toronto

El Bruno

References

#VS2017 – ASP.Net, IIS Express, #OneDrive y el freaking error “The IIS Express applicationHost.config file contains invalid entries and must be corrected before you can open project”

Buenas!

En estos últimos meses OneDrive ha habilitado una nueva feature que es grandiosa [Files On Demand]. Si tienes TeraBytes de información en OneDrive, esta es una excelente forma de optimizar el espacio y la sincronización entre varios dispositivos.

I1

Pues bien, otra feature que posee OneDrive desde hace un tiempo es la de sincronizar automáticamente tus perfiles entre diferentes Devices. Por ejemplo, si utilizas 2 dispositivos con la misma cuenta de OneDrive, puedes configurar el mismo para que todos los archivos que tengas en tu escritorio y en tus documentos se sincronizan entre estos dispositivos.

I2

En mi caso, suelo desarrollar en un PC con bastante potencia y luego tengo mi “crappy SurPro4” para demos y sesiones. Tengo activada la opción de sincronizar los Desktops desde hace tiempo, y se me ocurrió que tal vez sincronizar los documentos también era buena idea.

Pues bien, mientras estoy practicando un par de sesiones sobre Azure y Amazon Alexa me di cuenta que al abrir un proyecto web en mi Surface Pro 4 y al intentar cargar el mismo en Visual Studio 2017, me encontraba con este error

—————————

Microsoft Visual Studio

—————————

The IIS Express applicationHost.config file contains invalid entries and must be corrected before you can open project [$ProjectName].

Filename: redirection.config

Error: Cannot read configuration file

—————————

OK  

—————————

Esto me tuvo de los nervios un buen rato, ya que los valores en este archivo estaban correctos. Sin embargo, Visual Studio 2017 no podía cargar los proyectos ASP.Net. En un momento de lucidez, me di cuenta de que estos archivos no se estaban cargando del [%USER_PATH] sino desde OneDrive

I3

Y claro, parece que IIS Express no se lleva bien con Onedrive. En este momento la solución pasaba por

  • Cancelar la sincronización de la carpeta de Documentos
  • Configurar mis proyectos para que utilicen IIS en lugar de IIS Express

Como la 2da opción es siempre mucho mas practica al momento de trabajar, pues esto es lo que he hecho y todos felices.

Happy Coding!

Saludos @ Toronto

El Bruno

References

#VS2017– Azure WebApi App, Amazon Alexa Skills and the error “I’m not sure what went wrong” (you get tired of listening!)

Hi!

Just over a month ago Amazon officially launched its Amazon Echo line in Canada. In Avanade we will host an event specially dedicated to Artificial Intelligence and Voice Interfaces. And now that the holiday season has finished, it’s time to share some of the lessons learned over the last few months working with Alexa Skills.

Using simple words to describe how an Alexa Skill works, we could say that the Skill allows us to connect the audio processing of Amazon Echo with an HTTP service. By default, Amazon proposes us to use an AWS Lambda. If we switch to the Azure world, we have several options, for example, Use a Azure Function or a website in a AppService.

I1

I choose the 2nd option and then it was time to configure my controllers to be compatible with the POST requests made by my Amazon Skill.

Note: If you work with .net there is a NuGet package for this, AlexaSkillsKit.Net

After configuring my Intents, Slots and the operation of my Skill, it’s time to test it. In the most minimalist tester in the history of the Internet, everything worked OK.

I2

The HTTP requests my Alexa skills performed communicated correctly with my App Service in Azure. Even in the new Test Simulator (Beta) everything worked properly.

I3

Note: The 2nd one is a really good Test environment. The default test interface is, like saying it without offending anyone, “very simple”.

Well, everything is working perfectly until the time to try it on the Amazon Echo. Every time I tested it, Alexa told me the following phrase:

“I’m not sure what went wrong”

I4

I spent a lot of time trying to find the error. I enabled all kinds of traces, both in Azure and in the Alexa Skills, and I could not find anything that works bad. At those moments I usually take advantage to go running and to clear my mind a little bit, but with the weather these days, I had to relax in other ways.

I5

The solution arrived to me when I was showing my girl and my children, how to program an Alexa Skill. I was thinking of creating something with Scratch so that my children can create their own conversations/skills with Alexa, when I realized that:

I had configured my device with Language English (Canada) and when you create a Skill, by default it is created in English (U. S).

I6

Note: It is still English, but you see that Amazon friends are sensitive about it 😀 Really, there are very clear reasons why skills have to be identified by country, legal issues, copyright and more.

Well, right now I have 2 solutions for my skills to work

  • Change the location of the device to United States
  • Add a new Language to my Alexa Skill

I7

Obviously the best is the 2nd option. And, while it is not as trivial as it seems, once my skill supports the new language, I no longer have to deal with the beautiful phrase

“I’m not sure what went wrong”

And finally I was able to continue testing my skills in the device!

In next posts I will comment on the quick way in which I have learned to have a Skill with multiple languages.

Happy Coding!

Greetings @ Toronto

El Bruno

References