2

I have trained a model using AWS SageMaker and downloaded the model from SageMaker. The model .bin file is 1.7GB in size.

Now, I am loading the model using fasttext(https://fasttext.cc/docs/en/unsupervised-tutorial.html) using below code

model = fasttext.load_model(os.path.join(model_dir, 'vectors.bin'))

It takes atleast 4 secs to load the model in my local machine as well as in an EC2 instance.

How can I improve the loading time

slysid
  • 5,236
  • 7
  • 36
  • 59
  • 2
    4 seconds seems pretty fast to me! That's a lot of data, and 1.7GB / 4 seconds = 425 MB per second. Spinning hard drives read about 125MB per second; SSDs commonly read around 550 MB per second. So the main limit may be disk IO that the FastText-specific code can't optimize much further. Why isn't 4 seconds fast enough? – gojomo Oct 15 '20 at 01:46
  • Thank you. I am using fasttext to load a model in AWS Sagemaker Batchtransform workflow. I have close to 200 mil records to process and in each invocation cycle loading model is loaded and inferred. Looking ways to bring down the processing time. – slysid Oct 15 '20 at 19:45
  • 3
    I am unfamiliar with the particular limitations of 'AWS Sagemaker Batchtransform' workflow, but two general purpose techniques might be: (1) find some way to keep the same loaded model in memory across longer batches/sessions; (2) if RAM is plentiful, place the model in a RAM disk so that even repeated loads (from disk RAM to program RAM) are at RAM rather than HDD/SDD speeds. – gojomo Oct 15 '20 at 20:52

0 Answers0