我希望在我制作并保存为.bins3 上的文件的 ML 管道中使用 FastText 模型。我希望将这一切都保存在基于云的管道中,所以我不想要本地文件。我觉得我真的很接近,但我不知道如何制作一个临时.bin文件。我也不确定我是否以最有效的方式保存和阅读 FastText 模型。下面的代码有效,但它在本地保存了我想避免的文件。
import smart_open
file = smart_open.smart_open(s3 location of .bin model)
listed = b''.join([i for i in file])
with open("ml_model.bin", "wb") as binary_file:
binary_file.write(listed)
model = fasttext.load_model("ml_model.bin")