Search code examples
modelspacyamazon-sagemakerartifacttar.gz

Loading a spacy .tar.gz model artifact from s3 Sagemaker


I have a pretrained spacy model on a local folder that I can easily read with m = spacy.load("path/model/")

But now I have to upload it as a .tar.gz file to use as a Sagemaker model artifact. How can I read this .tar.gz file?

Ideally I want to read the unzipped folder from memory. Without extracting all to disk and then reading it again

My question is almost a duplicate of this one Directly load spacy model from packaged tar.gz file. But the answers don't explain how to untar unzip the folder into memory


Solution

  • Turns out Sagemaker already decompress the .tar.gz file automatically. So I can just read the folder exactly like before.