# Step 2: Build the dictionary and replace rare words with UNK token.
vocabulary_size = 50000
def build_dataset(words, n_words):
"""Process raw inputs into a dataset."""
count = [['UNK', -1]]
count.extend(collections.Counter(words).most_common(n_words - 1))
dictionary = dict()
for word, _ in count:
dictionary[word] = len(dictionary)
data = list()
unk_count = 0
for word in words:
if word in dictionary:
index = dictionary[word]
else:
index = 0 # dictionary['UNK']
unk_count += 1
data.append(index)
count[0][1] = unk_count
reversed_dictionary = dict(zip(dictionary.values(), dictionary.keys()))
return data, count, …Run Code Online (Sandbox Code Playgroud) 我在以下链接中关注 Oreilly 指导的 ImageCaption 生成项目
https://www.oreilly.com/learning/caption-this-with-tensorflow
Run Code Online (Sandbox Code Playgroud)
但是,虽然我正在关注 github docker 选项 A,其中 github 对应于上述说明,但我安装了 docker 并运行了 jupyter,但始终显示令牌身份验证页面。
https://github.com/mlberkeley/oreilly-captions?utm_source=newsite&utm_medium=content&utm_campaign=lgen&utm_content=caption-this-with-tensorflow-top-cta
Run Code Online (Sandbox Code Playgroud)
但是每当我复制并粘贴我从终端窗口给出的令牌时,它就会不断返回 "invalid credentials"
可能的原因是什么?
按照感谢的 youtube 链接,刚刚通过我的 Anaconda Prompt 轻松成功地安装了 tensorflow。
我所做的是:
1) conda create -n tensor2 python=3
首先我创建了一个名为 tensor2 的虚拟环境(我不知道为什么我需要这个)以及-n指的是什么?
2) 然后激活 tensor2 虚拟环境,然后运行pip install tensorflow.
所以总结一下这个问题:
1) 为什么我需要为模块 tensorflow 创建 Virtual Enviornmnet 而其他模块只是立即使用 pip install?
2) 附加的问题是,-n 在上面的命令中指的是什么?而且,-m 在语句“python -m pip install /module name/”中指的是什么?