You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importosimportargparseimportsysfromtempfileimportgettempdirfromsix.movesimporturllibcurrent_path=os.path.dirname(os.path.realpath(sys.argv[0]))
parser=argparse.ArgumentParser()
parser.add_argument(
'--log_dir',
type=str,
default=os.path.join(current_path, 'log'),
help='The log directory for TensorBoard summaries.')
FLAGS, unparsed=parser.parse_known_args()
# Create the directory for TensorBoard variables if there is not.ifnotos.path.exists(FLAGS.log_dir):
os.makedirs(FLAGS.log_dir)
# Step 1: Download the data.# http://www.fit.vutbr.cz/~imikolov/rnnlm/simple-examples.tgzurl=' http://www.fit.vutbr.cz/~imikolov/rnnlm/'# pylint: disable=redefined-outer-namedefmaybe_download(filename, expected_bytes):
"""Download a file if not present, and make sure it's the right size."""local_filename=os.path.join(gettempdir(), filename)
ifnotos.path.exists(local_filename):
local_filename, _=urllib.request.urlretrieve(url+filename,
local_filename)
statinfo=os.stat(local_filename)
ifstatinfo.st_size==expected_bytes:
print('Found and verified', filename)
else:
print(statinfo.st_size)
raiseException('Failed to verify '+local_filename+'. Can you get to it with a browser?')
returnlocal_filenamefilename=maybe_download('simple-examples.tgz', 34869662)
1. Kaggle download dataset
Reference: tensorflow_official_word2vec_skipgram.ipynb
2. Kaggle unzip .tgz file in temp
A new folder named 'simple-examples' will be created in
/tmp
, and go to find the .txt fileThe text was updated successfully, but these errors were encountered: