When a user sets up a new Looking Similar model, it will start training immediately. Sometimes the model will fail to train, and display an error message.
This guide lists some of the common reasons why the model will fail to train and how to solve them.
1. Is the image attribute set correctly?
If your images are not displayed correctly in the Dashboard, you can check this article.
If the image URLs are indexed in arrays or objects, and we want to target a specific position of the array, then we need to check that the format of the attribute is valid. Even though the Dashboard displays the image, bracket notation for the attribute is not supported in the models images[0].src
, dot notation must be used e.g.images.0.src
.
If the data is normalised so that it is contained in an array of string URLs, then the entire list of images would be used instead of having to pick object by object.
2. Is the URL prefix and suffix set correctly?
If the image URL starts with a double slash //
it confuses the model builder, as it doesn’t know to use HTTP
or HTTPS
. In this case, you need to add a prefix https:
to your configuration.
3. Is your server blocking Algolia? (Also applies if the model training is stuck “in progress”)
It is possible that your server is blocking Algolia from downloading your images. In this case, you will need to ask your developers to whitelist this user agent AlgoliaRecommend/LookingSimilar
and try to train the model again.
You can also/alternatively whitelist the following IP ranges which are used when fetching images:
-
Allowing the IP addresses
35.246.169.178
and34.107.119.219
(for EU apps) -
Allowing the IP addresses
34.74.175.40
and34.75.119.78
(for US apps)
4. Is there a rate limit applied on your server that is blocking the model? (Also applies if the model training is stuck “in progress”)
If this is the case, then you can apply a bypass of the above IP addresses to resolve this issue and try to train the model again.