I have a .bin file in a blob in Azure Blob Storage.
I would like to use it to give to fasttext to use a method.
I tried it:
fr_embedding_file_path = "cc_fr_300_bin/cc.fr.300.bin"
fr_embedding_file = client.get_blob_client(blob=fr_embedding_file_path)
fr_embedding_file = fr_embedding_file.download_blob()
fr_model = fasttext.load_model(fr_embedding_file)
I think I have to do something else after fr_embedding_file = fr_embedding_file.download_blob()
but don't know what. The size of bin file is 7GB and comes from https://fasttext.cc/docs/en/crawl-vectors.html
I have this message :
'TypeError: loadModel(): incompatible function arguments. The following argument types are supported: 1. (self: fasttext_pybind.fasttext, arg0: str) -> None
Invoked with: <fasttext_pybind.fasttext object at ...>, <azure.storage.blob._download.StorageStreamDownloader object at ...>'
What can I do ?
Please check if given references help to work around:
As per the error the arg0 (1st positional argument) should be a str(string). fasttext.load_model accepts first argument as string or char and second argument is utf-8 encoding which is optional.
See if fasttext.load_model(str) can only load files from the local filesystem. Try to copy the data to the local filesystem and then load it from there, e.g. Check this reference from Stack Overflow. Try to download blob to a file and load that file
blob.download_to_filename(local_model_file)
model_1 = fasttext.load_model(local_model_file)
Please see if you can use methods like content_as_bytes or content_as_text or stream from azure.storage.blob.StorageStreamDownloader class and iterate through them or try make the argument to str () as in reference 1 .
Please check below references to work around :