在Azure Machine Learning Studio上安装fastText Python库

2024-05-20 11:55:10 发布

您现在位置:Python中文网/ 问答频道 /正文

< P> >我想在Azure ML工作室上安装脸谱网C++库的Python fastText包装器。这个库已安装并在我的笔记本电脑上正常工作。在

我尝试按照this堆栈溢出线程中的说明在Azure上上载,但没有成功。在

“executepython脚本”中的代码非常简单:我只需解压缩并加载我在本地计算机上安装的fastText包,然后调用fastText模块的“train_supervied”属性的help函数来验证包是否正确导入


# The script MUST contain a function named azureml_main
# which is the entry point for this module.

import fastText

# The entry point function can contain up to two input arguments:
#   Param<dataframe1>: a pandas.DataFrame
#   Param<dataframe2>: a pandas.DataFrame

def azureml_main(dataframe1 = None, dataframe2 = None):

    print(help(fastText.train_supervised))

    # Return value must be of a sequence of pandas.DataFrame
    return dataframe1,

在运行这个最小的Azure实验时,我得到以下错误:

^{2}$

我还尝试在我的本地计算机上创建一个虚拟环境(使用conda),并在其中安装fastText及其依赖项,但我没有成功。我们的目标是压缩并上传这些库到Azure。这是因为,为了与azurepython环境兼容,我需要3.5.1python版本(anaconda4.0)。在

感谢任何帮助/指导!在


Tags: thedataframepandasmainhelpfunctiontrainthis
1条回答
网友
1楼 · 发布于 2024-05-20 11:55:10

对于我写的SO-thread帖子有一个更完整的答案:Updating pandas to version 0.19 in Azure ML Studio。在

您应该在virtualenv中通过pip安装Cypython和{},然后您需要将下面这些模块(按pip freeze列出)打包到zip文件中,并将其上载到azureml Studio。在

Cython==0.29.10
fasttext==0.8.3
future==0.17.1
numpy==1.16.4

但是,代码中有两个问题,如下所示。在

  1. 在Python中导入fasttext,而不是{},这将导致{}。

  2. 实际上,没有一个名为train_supervised的属性,我得到了一个错误AttributeError: module 'fasttext' has no attribute 'train_supervised'。我试图通过在线的fasttextapi引用All Functions&;All Variables找到它,它实际上并不存在,只是supervised。在

    enter image description here

希望有帮助。在

相关问题 更多 >