簡體   English   中英

在Tensorflow上運行示例程序時獲取“ PermissionDeniedError”

[英]Getting “PermissionDeniedError” when running the example program on Tensorflow

抱歉,我缺乏知識,但我試圖在Tensorflow上運行該示例:

import numpy as np
import tensorflow as tf

feature_columns = [tf.feature_column.numeric_column("x", shape=[1])]

estimator = tf.estimator.LinearRegressor(feature_columns=feature_columns)

x_train = np.array([1., 2., 3., 4.])
y_train = np.array([0., -1., -2., -3.])
x_eval = np.array([2., 5., 8., 1.])
y_eval = np.array([-1.01, -4.1, -7, 0.])
input_fn = tf.estimator.inputs.numpy_input_fn(
    {"x": x_train}, y_train, batch_size=4, num_epochs=None, shuffle=True)
train_input_fn = tf.estimator.inputs.numpy_input_fn(
    {"x": x_train}, y_train, batch_size=4, num_epochs=1000, shuffle=False)
eval_input_fn = tf.estimator.inputs.numpy_input_fn(
    {"x": x_eval}, y_eval, batch_size=4, num_epochs=1000, shuffle=False)


estimator.train(input_fn=input_fn, steps=1000)

train_metrics = estimator.evaluate(input_fn=train_input_fn)
eval_metrics = estimator.evaluate(input_fn=eval_input_fn)
print("train metrics: %r"% train_metrics)
print("eval metrics: %r"% eval_metrics)

我收到以下錯誤消息:PermissionDeniedError:無法刪除文件:C:\\ Users \\ Jeff \\ AppData \\ Local \\ Temp \\ tmpgpmjek44 \\ graph.pbtxt.tmpe31b9f4677cb426fbaef32dadeaf1a4d; 沒有權限

我發現錯誤來自“ estimator.train(input_fn = input_fn,steps = 1000)”行。 我試圖查看文件夾和文件。 他們已經被授予完全控制權。 這也許是一個愚蠢的問題,但是這里可能有什么原因和解決方案。 提前非常感謝您!

更新:

我從根目錄運行它,並得到以下信息:

(C:\\ Users \\ Jeff \\ Anaconda3)C:\\ Users \\ Jeff> python test.py警告:tensorflow:使用臨時文件夾作為模型目錄:C:\\ Users \\ Jeff \\ AppData \\ Local \\ Temp \\ tmp0yywjv30 2017-11-11 10 22:54:59.808636:IC:\\ tf_jenkins \\ home \\ workspace \\ rel-win \\ M \\ windows-gpu \\ PY \\ 36 \\ tensorflow \\ core \\ platform \\ cpu_feature_guard.cc:137]您的CPU支持此TensorFlow二進制文件的指令未編譯使用:AVX AVX2 2017-11-10 22:55:00.096842:IC:\\ tf_jenkins \\ home \\ workspace \\ rel-win \\ M \\ windows-gpu \\ PY \\ 36 \\ tensorflow \\ core \\ common_runtime \\ gpu \\ gpu_device.cc:1030]找到的設備0具有以下屬性:名稱:GeForce GTX 1060 major:6 minor:1 memoryClockRate(GHz):1.6705 pciBusID:0000:01:00.0 totalMemory:6.00GiB freeMemory:4.99GiB 2017-11-10 22 :55:00.096927:IC:\\ tf_jenkins \\ home \\ workspace \\ rel-win \\ M \\ windows-gpu \\ PY \\ 36 \\ tensorflow \\ core \\ common_runtime \\ gpu \\ gpu_device.cc:1120]創建TensorFlow設備(/ device:GPU :0)->(設備:0,名稱:GeForce GTX 1060,PCI總線ID:0000:01:00.0,計算能力:6.1)2017-11-10 22:55:02.512317: EC:\\ tf_jenkins \\ home \\ workspace \\ rel-win \\ M \\ windows-gpu \\ PY \\ 36 \\ tensorflow \\ stream_executor \\ cuda \\ cuda_blas.cc:366]無法創建cublas句柄:CUBLAS_STATUS_ALLOC_FAILED 2017-11-10 22:55 :02.513461:EC:\\ tf_jenkins \\ home \\ workspace \\ rel-win \\ M \\ windows-gpu \\ PY \\ 36 \\ tensorflow \\ stream_executor \\ cuda \\ cuda_blas.cc:366]無法創建cublas句柄:CUBLAS_STATUS_ALLOC_FAILED 2017-11-10 22:55:02.513601:EC:\\ tf_jenkins \\ home \\ workspace \\ rel-win \\ M \\ windows-gpu \\ PY \\ 36 \\ tensorflow \\ stream_executor \\ cuda \\ cuda_blas.cc:366]無法創建cublas句柄:CUBLAS_STATUS_ALLOC_FAILED 2017- 11-10 22:55:02.514975:EC:\\ tf_jenkins \\ home \\ workspace \\ rel-win \\ M \\ windows-gpu \\ PY \\ 36 \\ tensorflow \\ stream_executor \\ cuda \\ cuda_blas.cc:366]無法創建cublas句柄: CUBLAS_STATUS_ALLOC_FAILED 2017-11-10 22:55:02.515067:WC:\\ tf_jenkins \\ home \\ workspace \\ rel-win \\ M \\ windows-gpu \\ PY \\ 36 \\ tensorflow \\ stream_executor \\ stream.cc:1901]嘗試執行BLAS操作在不具有BLAS支持的情況下使用StreamExecutor追溯(最近一次通話):文件 _do_call中的“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ client \\ session.py”行1323返回fn(* args)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ client \\ session.py“,第1302行,處於_run_fn狀態,run_metadata)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ framework \\ errors_impl。 py“,第473行,位於出口 c_api.TF_GetCode(self.status.status))tensorflow.python.framework.errors_impl.InternalError:Blas GEMV啟動失敗:m = 1,n = 4 [[節點:linear / linear_model / x / weighted_sum = MatMul [T = DT_FLOAT,transpose_a = false,transpose_b = false,_device =“ / job:localhost / replica:0 / task:0 / device:GPU:0”](線性,linear_linear_model / x / Reshape,線性/ linear_model / x / weights)]] [[節點:linear / gradients / linear / linear_model / x / weighted_sum_grad / tuple / control_dependency_1 / _85 = _Recvclient_terminated = false,recv_device =“ / job:localhost /副本:0 /任務:0 / device:CPU:0“,send_device =” / job:localhost /副本:0 / task:0 / device:GPU:0“,send_device_incarnation = 1,tensor_name =” edge_184_linear / gradients / linear / linear_model / x / weighted_sum_grad / tuple / control_dependency_1“,tensor_type = DT_FLOAT,_device =” / job:localhost / replica:0 / task:0 / device:CPU:0“]]

在處理上述異常期間,發生了另一個異常:

追溯(最近一次通話):estimator.train中第39行的文件“ test.py”(input_fn = input_fn,步驟= 1000)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ estimator \\ estimator.py“,第302行,火車損耗= self._train_model(input_fn,hook,saving_listeners)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ estimator \\ estimator .py“,第783行,在_train_model _中,損失= mon_sess.run([estimator_spec.train_op,estimator_spec.loss])文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ training \\在運行run_metadata = run_metadata中,第521行被監視[session.py]”)在運行run_metadata = run_metadata中,文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ training \\ monitored_session.py”在行892中)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ training \\ monitored_session.py”,行967,運行中引發六。reraise(* original_exc_info)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ six.py“,第693行,在提高價值文件中 “ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ training \\ monitored_session.py”,第952行,在運行中返回self._sess.run(* args,** kwargs)文件“ C: \\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ training \\ monitored_session.py“,行1024,在運行run_metadata = run_metadata)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ training \\ monitored_session.py“,行827,在運行中返回self._sess.run(* args,** kwargs)文件” C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ client \\ session.py”,第889行,在運行run_metadata_ptr中)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ client \\ session.py”,第1120行,在_run feed_dict_tensor中,選項,run_metadata)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ client \\ session.py”,行1317,在_do_run選項中,run_metadata)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ client \\ session.py“,行1336,在_do_call中引發類型(e)(node_def,op,message)張量流 .python.framework.errors_impl.InternalError:Blas GEMV啟動失敗:m = 1,n = 4 [[節點:linear / linear_model / x / weighted_sum = MatMul [T = DT_FLOAT,transpose_a = false,transpose_b = false,_device =“ / job:localhost / replica:0 / task:0 / device:GPU:0“](linear / linear_model / x / Reshape,linear / linear_model / x / weights)]] [[節點:linear / gradients / linear / linear_model / x / weighted_sum_grad / tuple / control_dependency_1 / _85 = _Recvclient_terminated = false,recv_device =“ / job:localhost /副本0 / task:0 / device:CPU:0”,send_device =“ / job:localhost /副本0 / task:0 / device:GPU:0“,send_device_incarnation = 1,tensor_name =” edge_184_linear / gradients / linear / linear_model / x / weighted_sum_grad / tuple / control_dependency_1“,tensor_type = DT_FLOAT,_device =” / job:localhost /副本:0 / task:0 / device:CPU:0“]]

由op'linear / linear_model / x / weighted_sum'引起,定義於:estimator.train(input_fn = input_fn,steps = 1000)文件“ test.py”,第39行,文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ estimator \\ estimator.py“,第302行,火車損耗= self._train_model(input_fn,hooks,saving_listeners)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ estimator \\ estimator.py”,第711行,位於_train_model功能,標簽,model_fn_lib.ModeKeys.TRAIN,self.config)中,文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ estimator \\ estimator.py“,第694行,位於_call_model_fn model_fn_results = self._model_fn(features = features,** kwargs)File” C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ estimator \\ canned \\ linear.py”,第348行,在_model_fn config = config中)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ estimator \\ canned \\ linear.py”,第118行,在_linear_model_fn中logits = logit_fn(features = features)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site -packages \\ tensorflow \\ python \\ estimator \\ canned \\ linear.py“,第70行,位於linear_logit_fn features = features,feature_columns = feature_columns,units = units)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site \\ packages \\ tensorflow \\ python \\ feature_column \\ feature_column.py“,第321行,位於linear_model列,構建器,單位,weight_collections,可訓練中))文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ feature_column \\在_create_dense_column_weighted_sum中的“ feature_column.py”行1376中,返回math_ops.matmul(張量,權重,名稱=“ weighted_sum”)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ ops \\ math_ops。 py”,第1891行,在內容a,b中,transpose_a = transpose_a,transpose_b = transpose_b,名稱= name)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ ops \\ gen_math_ops.py “,在_mat_mul name = name中的第2436行,文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ framework \\ op_def_library.py”,在第787行,在_apply_op_helper op_def = op_def)文件“ C:\\ Users \\ Jeff \\ Ana conda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ framework \\ ops.py“,第2956行,位於create_op op_def = op_def)文件“ C:\\ Users \\ Jeff \\ Anaconda3 \\ lib \\ site-packages \\ tensorflow \\ python \\ framework \\ ops.py“,第1470行,在初始化 self._traceback = self._graph._extract_stack()#pylint:disable = protected-access

InternalError(內部錯誤,請參見上面的追溯):Blas GEMV啟動失敗:m = 1,n = 4 [[節點:linear / linear_model / x / weighted_sum = MatMul [T = DT_FLOAT,transpose_a = false,transpose_b = false,_device =“ / job:localhost / replica:0 / task:0 / device:GPU:0“](linear / linear_model / x / Reshape,linear / linear_model / x / weights)]] [[節點:linear / gradients / linear / linear_model / x / weighted_sum_grad / tuple / control_dependency_1 / _85 = _Recvclient_terminated = false,recv_device =“ / job:localhost / replica:0 / task:0 / device:CPU:0”,send_device =“ / job:localhost / replica:0 / task :0 / device:GPU:0“,send_device_incarnation = 1,tensor_name =” edge_184_linear / gradients / linear / linear_model / x / weighted_sum_grad / tuple / control_dependency_1“,tensor_type = DT_FLOAT,_device =” / job:localhost /副本:0 /任務:0 /設備:CPU:0“]]

它的PermissionDeniedError:您應該從根目錄運行此腳本,如我現在所見。 試試看並更新。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM