Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Tensorflow.js节点未找到后端_Javascript_Node.js_Tensorflow_Npm - Fatal编程技术网

Javascript Tensorflow.js节点未找到后端

Javascript Tensorflow.js节点未找到后端,javascript,node.js,tensorflow,npm,Javascript,Node.js,Tensorflow,Npm,我想创建一个使用@tensorflow models/qna库的Discord bot,但我已经收到了4个小时的相同错误,没有任何进展。当我尝试运行此脚本时: const qna = require('@tensorflow-models/qna'); (async () => { const passage = "Google LLC is an American multinational technology company that specializes in

我想创建一个使用@tensorflow models/qna库的Discord bot,但我已经收到了4个小时的相同错误,没有任何进展。当我尝试运行此脚本时:

const qna = require('@tensorflow-models/qna');

(async () => {
    const passage = "Google LLC is an American multinational technology company that specializes in Internet-related services and products, which include online advertising technologies, search engine, cloud computing, software, and hardware. It is considered one of the Big Four technology companies, alongside Amazon, Apple, and Facebook. Google was founded in September 1998 by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University in California. Together they own about 14 percent of its shares and control 56 percent of the stockholder voting power through supervoting stock. They incorporated Google as a California privately held company on September 4, 1998, in California. Google was then reincorporated in Delaware on October 22, 2002. An initial public offering (IPO) took place on August 19, 2004, and Google moved to its headquarters in Mountain View, California, nicknamed the Googleplex. In August 2015, Google announced plans to reorganize its various interests as a conglomerate called Alphabet Inc. Google is Alphabet's leading subsidiary and will continue to be the umbrella company for Alphabet's Internet interests. Sundar Pichai was appointed CEO of Google, replacing Larry Page who became the CEO of Alphabet."
    const question = "Who is the CEO of Google?"
    const model = await qna.load();
    const answers = await model.findAnswers(question, passage);
    console.log(answers);
})();
它给了我以下错误:

(node:16340) UnhandledPromiseRejectionWarning: Error: No backend found in registry.
我试过安装tensorflow及其后端“tfjs后端cpu”的几十个不同版本。但似乎什么都不管用,我在谷歌上找到的现有答案也没有任何帮助。有人知道如何在节点14上运行该代码吗?

尝试添加:

require('@tensorflow/tfjs-core'); /* or @tensorflow/tfjs-node */
require('@tensorflow/tfjs-backend-cpu');
到您的文件的顶部。上的说明建议这应该自动发生,但我想情况并非如此