aymericdamien / TensorFlow-Examples

TensorFlow Tutorial and Examples for Beginners (support TF v1 & v2)
Other
43.42k stars 14.94k forks source link

can't run basic models due to mnist data #257

Open zhyongquan opened 6 years ago

zhyongquan commented 6 years ago

when i try basic models, i get follow error.

Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information.

RESTART: C:\Users\yongquan.zhang\Downloads\Compressed\TensorFlow-Examples-master\examples\2_BasicModels\logistic_regression.py WARNING:tensorflow:From C:\Users\yongquan.zhang\Downloads\Compressed\TensorFlow-Examples-master\examples\2_BasicModels\logistic_regression.py:16: read_data_sets (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version. Instructions for updating: Please use alternatives such as official/mnist/dataset.py from tensorflow/models. WARNING:tensorflow:From C:\Python\Python36\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\mnist.py:260: maybe_download (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version. Instructions for updating: Please write your own downloading logic. WARNING:tensorflow:From C:\Python\Python36\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py:252: _internal_retry..wrap..wrapped_fn (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version. Instructions for updating: Please use urllib or similar directly. Traceback (most recent call last): File "C:\Python\Python36\lib\urllib\request.py", line 1318, in do_open encode_chunked=req.has_header('Transfer-encoding')) File "C:\Python\Python36\lib\http\client.py", line 1239, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Python\Python36\lib\http\client.py", line 1285, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Python\Python36\lib\http\client.py", line 1234, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Python\Python36\lib\http\client.py", line 1026, in _send_output self.send(msg) File "C:\Python\Python36\lib\http\client.py", line 964, in send self.connect() File "C:\Python\Python36\lib\http\client.py", line 1400, in connect server_hostname=server_hostname) File "C:\Python\Python36\lib\ssl.py", line 401, in wrap_socket _context=self, _session=session) File "C:\Python\Python36\lib\ssl.py", line 808, in init self.do_handshake() File "C:\Python\Python36\lib\ssl.py", line 1061, in do_handshake self._sslobj.do_handshake() File "C:\Python\Python36\lib\ssl.py", line 683, in do_handshake self._sslobj.do_handshake() TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\yongquan.zhang\Downloads\Compressed\TensorFlow-Examples-master\examples\2_BasicModels\logistic_regression.py", line 16, in mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) File "C:\Python\Python36\lib\site-packages\tensorflow\python\util\deprecation.py", line 250, in new_func return func(*args, kwargs) File "C:\Python\Python36\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\mnist.py", line 260, in read_data_sets source_url + TRAIN_IMAGES) File "C:\Python\Python36\lib\site-packages\tensorflow\python\util\deprecation.py", line 250, in new_func return func(*args, *kwargs) File "C:\Python\Python36\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py", line 252, in maybe_download temp_filename, = urlretrieve_with_retry(source_url) File "C:\Python\Python36\lib\site-packages\tensorflow\python\util\deprecation.py", line 250, in new_func return func(args, kwargs) File "C:\Python\Python36\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py", line 205, in wrapped_fn return fn(*args, *kwargs) File "C:\Python\Python36\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py", line 233, in urlretrieve_with_retry return urllib.request.urlretrieve(url, filename) File "C:\Python\Python36\lib\urllib\request.py", line 248, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: File "C:\Python\Python36\lib\urllib\request.py", line 223, in urlopen return opener.open(url, data, timeout) File "C:\Python\Python36\lib\urllib\request.py", line 526, in open response = self._open(req, data) File "C:\Python\Python36\lib\urllib\request.py", line 544, in _open '_open', req) File "C:\Python\Python36\lib\urllib\request.py", line 504, in _call_chain result = func(args) File "C:\Python\Python36\lib\urllib\request.py", line 1361, in https_open context=self._context, check_hostname=self._check_hostname) File "C:\Python\Python36\lib\urllib\request.py", line 1320, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。>

zhyongquan commented 6 years ago

it may be because data download. i download data manually from http://yann.lecun.com/exdb/mnist/ and changed mnist.py. basic models work. but random_forest still bad.

`
mnist_path = "D:\PYProjects\tensorflow\mnist\" TRAIN_IMAGES = 'train-images-idx3-ubyte.gz' TRAIN_LABELS = 'train-labels-idx1-ubyte.gz' TEST_IMAGES = 't10k-images-idx3-ubyte.gz' TEST_LABELS = 't10k-labels-idx1-ubyte.gz'

local_file = base.maybe_download(TRAIN_IMAGES, train_dir,

source_url + TRAIN_IMAGES)

local_file=mnist_path + TRAIN_IMAGES with gfile.Open(local_file, 'rb') as f: train_images = extract_images(f)

local_file = base.maybe_download(TRAIN_LABELS, train_dir,

source_url + TRAIN_LABELS)

local_file = mnist_path + TRAIN_LABELS with gfile.Open(local_file, 'rb') as f: train_labels = extract_labels(f, one_hot=one_hot)

local_file = base.maybe_download(TEST_IMAGES, train_dir,

source_url + TEST_IMAGES)

local_file = mnist_path + TEST_IMAGES with gfile.Open(local_file, 'rb') as f: test_images = extract_images(f)

local_file = base.maybe_download(TEST_LABELS, train_dir,

source_url + TEST_LABELS)

local_file = mnist_path + TEST_LABELS with gfile.Open(local_file, 'rb') as f: test_labels = extract_labels(f, one_hot=one_hot) `