我的 R 代码如下,它会导致如下错误。但是,这在我的 Windows 本地机器上运行良好。只是在 ubuntu 服务器上出现如下错误。生成的 model.bin 文件在我的 Windows 本地机器上大约为 229 MB。不确定为什么我无法在 Ubuntu 服务器上训练模型,任何帮助都将不胜感激!
library(fastrtext)
model_file <- build_supervised(documents = data1[["V5"]],
targets = data1[["V3"]],
model_path = '/srv/shiny-server/text_cls/voc_single/mymodel',
dim = 30, lr = 0.1, epoch = 30, wordNgrams = 2)
Prepare and write tempfile at ... /tmp/RtmpLMf0uE/file9083d9d7650
Starting supervised training with following commands:
$ supervised -input /tmp/RtmpLMf0uE/file9083d9d7650 -output /srv/shiny-server/text_cls/voc_single/mymodel -lr 0.1 -dim 30 -ws 5 -epoch 30 -minCount 5 -minCountLabel 0 -neg 5 -wordNgrams 2 -loss ns -bucket 2000000 -minn 3 -maxn 6 -thread 12 -lrUpdateRate 100 -t 0.0001 -label __label__ -verbose 2
Error in model$execute(c("fasttext", commands)) :
/srv/shiny-server/text_cls/voc_single/mymodel.bin cannot be opened for saving.
答案1
您能用以下命令向我们展示授权设置吗
sudo ls -l /srv/shiny-server/text_cls/voc_single/mymodel.bin
您可以通过授权用户编辑该文件来解决授权问题
sudo chown yourusername /srv/shiny-server/text_cls/voc_single/mymodel.bin
sudo chmod 700 /srv/shiny-server/text_cls/voc_single/mymodel.bin