LightGBM error in subbmission


I am trying LightGBM in my solution, which works fine in the Google colab environment. But when I submit the entry, I get the following error:

OSError: cannot open shared object file: No such file or directory

Any help/ideas would be much appreciated. Submission number is # 120699.



Interesting timing.
Are you in R or python?
(I’m with R, zip file approach)…

I’m actually playing around with LightGBM for the last few days, only to realize (now) that it doesn’t seem like I can save the model into a RData format.

From what I understand so far, I can load it back, but then if I try to use it for predictions, R crashes.

I’m tired. Will look further into this tomorrow…

Hi @matt_simmerson

Yes this is a little unintuitive at the start. I can see you’re using Python on Colab.

Could you follow the advice on this thread?

That should solve it :slight_smile:

1 Like

@michael_bordeleau Is this locally? or on the AIcrowd side? If it works locally but crashes on our side let me know and I’ll see what can be done :+1:

you need to save it with and load it with lgb.load

1 Like


@alfarzan yep, this is crashing local, so no need to worry… yet :wink:

As @MakePredict mentioned, we need to use the special functions.

However, on my end, I decided to try saveRDS.lgb.Booster

The challenge is combining this with other models… Juggling between RData and RDS… Major overhauling of my code. Today has been 100% debugging… (yikes)

So yeah, anyone reading this using R, tread carefully around lightgbm if you decide on using it. I’ve had other several issues with it. As an example, for some reason, I need FIRST to run a small lightgbm tutorial first before attempting modeling or it will crash …every… …single… time… urrh.

Good luck! :robot:

1 Like

Hi everybody,

I’m running into problems with lightgbm in R too (I’m using google colab notebook for my submissions).

As @michael_bordeleau said, lightgbm is difficult to handle. My problem, as said above, is in the saving /loading step.

I tested and saveRDS.lgb.Booster/readRDS.lgb.Booster. With both alternatives my code runs ok in google colab but my submission fails.

I’m saving into save_model function each model into a different .rds file and loading them in the same way. In the review of my submission error I see a error message in the loading step: “Error in lgb.load(file = “trained_model_Freq.rds”) :
lgb.load: file ‘trained_model_Freq.rds’ passed to filename does not exist”.

So, It is mandatory save all models in a model object and save it into trained_model.Rdata? How is possible do that with specific functions of lightgbm?

My submissions ID is 120892.

Thanks in advance.


I think the fix in your case should be quite simple :muscle:

So for R notebooks what you can do to use anything other than a .RData file is to just make sure you save the object inside the saved_objects/ directory.

So if your two models are: trained_model_Freq.rds and trained_model_Sev.rds then in your load_model and save_model you should have something like:

save_model <- function(freq_lgb, sev_lgb){, 'saved_objects/trained_model_Freq.rds'), 'saved_objects/trained_model_Sev.rds')

load_model <- function(){
  freq_lgb = lgb.load(file = 'saved_objects/trained_model_Freq.rds')
  sev_lgb = lgb.load(file = 'saved_objects/trained_model_Sev.rds')
  model = c('frequency' = freq_lgb, 'severity' = sev_lgb)

That’s basically the gist of it. We then take everything inside saved_objects/ and push it to the server. This directory is created when you setup the notebook and run the AIcrowd cell at the beginning.

Hope that makes it work, if not then we can continue the discussion :point_down:

1 Like

Hi @alfarzan

Thank you so much!

I hadn’t used the saved_objects directory before, that was the problem. It works perfectly for me now.


1 Like