BERTopic 将GPU模型转换为CPU进行推理

6tqwzwtp  于 2个月前  发布在  其他
关注(0)|答案(1)|浏览(34)

I am training a model with the GPU versions of UMAP and HDBSCAN for better performance. Once finished I would like to use the model to perform daily inference on new data. Is it possible to convert the GPU UMAP and HDBSCAN model to CPU variants, so that I am not required to use the GPU for inference?
Thanks?

dluptydi

dluptydi1#

据我所知,无法直接从cuML的UMAP和HDBSCAN跳转到原始实现。然而,您可以做的事情是使用safetensors or pytorch保存BERTopic模型的结果,然后将它们加载进来。当您以这种方式保存它们时,UMAP和HDBSCAN将被移除且不会用于推理。相反,将计算并比较嵌入与主题嵌入进行分配。
这样一来,您可以使用GPU训练模型,然后使用CPU加载它们。但请注意,嵌入模型通常在GPU上执行速度要快得多。

相关问题