Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1096894: Calling multiple registered models in snowsql returns NULL output for all but the first model #89

Closed
adaykoth opened this issue Feb 23, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@adaykoth
Copy link

adaykoth commented Feb 23, 2024

Suppose I have registered models m1, m2 and m3 in the core db under the schema models.
The following query will return NULL for the second and third predict call:

SELECT
    id,
    core.models.m1!predict(a,b,c,),
    core.models.m2!predict(a,b,c,),
    core.models.m3!predict(a,b,c)
FROM features

Note that calling the models independently in a query produces correct results and switching the order of the model call also changes which model produces a non-null output. It is always the first one.

@github-actions github-actions bot changed the title Calling multiple registered models in snowsql returns NULL output for all but the first model SNOW-1096894: Calling multiple registered models in snowsql returns NULL output for all but the first model Feb 23, 2024
@adaykoth
Copy link
Author

adaykoth commented Mar 1, 2024

To update this:
I've done a bit more testing and it appears that this does not generically return NULL.
Instead what seems to happen is that the first model is called three times per row instead of three different models one time.
This means that if you try to extract differently named outputs of the returned json, the return of the second and third model call will return null.

So as a minimal example:

SELECT core.test.model1!predict(0.1,0.1,0.1),
        core.test.model2!predict(0.1,0.1,0.1);

will return identical values, even if calling the model 2 separately will return a different value to model 1.

So in essence you can call at most one modell per query currently.

@sfc-gh-sdas
Copy link
Collaborator

Sorry for late reply. Given it is consistently reproducing for you with same signature functions, would you please confirm if you observe the same between two versions of same model? That is, store model2 as new version V2 inside model1 while keeping original as default version in model1 and call like:

WITH model2 AS model1 VERSION V2
    SELECT mv!predict(0.1,0.1,0.1), model1!predict(0.1,0.1,0.1);

@sfc-gh-aponnusamy
Copy link

sfc-gh-aponnusamy commented Mar 5, 2024

Just to update @adaykoth - We are still investigating this issue. I tried this and the resolution seems to be ok. We will keep you posted if we discover something

snowman#[email protected]>select current_date(),mydb.myschema.mod1!snore(1),mydb.myschema.mod2!snore(1),mydb.myschema.mod3!snore(1) from (select 1);
+----------------+-----------------------------+-----------------------------+-----------------------------+
| CURRENT_DATE() | MYDB.MYSCHEMA.MOD1!SNORE(1) | MYDB.MYSCHEMA.MOD2!SNORE(1) | MYDB.MYSCHEMA.MOD3!SNORE(1) |
|----------------+-----------------------------+-----------------------------+-----------------------------|
| 2024-03-05     | [                           | [                           | [                           |
|                |   "my model1 - Zzz"         |   "my model2 - Zzz"         |   "my model3 - Zzz"         |
|                | ]                           | ]                           | ]                           |
+----------------+-----------------------------+-----------------------------+-----------------------------+

As you can see in the above example, I have three different models and each model is invoking its method.

@sfc-gh-wzhao sfc-gh-wzhao added the bug Something isn't working label Mar 20, 2024
@sfc-gh-shchen
Copy link

Hi @adaykoth fyi the team is actively working on the fix.

@sfc-gh-wzhao
Copy link
Collaborator

Hi @adaykoth ,

We have identified the root cause and implemented the fix in the just released 1.4.0 version. You need to upgrade and re-log your model so that they could work in the same query. We are closing this issue, however, if you have any problems or find this issue still exists, please reopen it. Thank you for your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants