【问题标题】:train.py error in ibm watson retrieve and rank service setupibm watson 检索和排名服务设置中的 train.py 错误
【发布时间】:2016-05-03 21:02:58
【问题描述】:

我正在关注retrieve and rank tutorial,在 train.py 脚本之前一切都很好 - 我收到错误“ValueError: No JSON object could be decoded

我的命令行带有屏蔽的凭据:

python ./train.py -u "zzzz":"ssss" -i /Users/nik/Downloads/cranfield_gt.csv -c "zzzz" -x example_collection -n "example_ranker"

结果:

    Input file is /Users/nik/Downloads/cranfield_gt.csv
Solr cluster is zzzz
Solr collection is example_collection
Ranker name is example_ranker
Rows per query 10
Generating training data...
Command:
curl -k -s  -u zzzz:ssss -d "q=what similarity laws must be obeyed when constructing aeroelastic models of heated high speed aircraft.&gt=184,3,29,3,31,3,12,2,51,2,102,2,13,1,14,1,15,1,57,3,378,3,859,3,185,2,30,2,37,2,52,1,142,1,195,1,875,3,56,2,66,2,95,2,462,1,497,2,858,2,876,2,879,2,880,2,486,0&generateHeader=true&rows=10&returnRSInput=true&wt=json" "https://gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters/zzzz/solr/example_collection/fcselect"
Response:

Traceback (most recent call last):
  File "./train.py", line 88, in <module>
    parsed_json = json.loads(output)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

我得到这个错误的原因以及最重要的是如何解决它的想法?

谢谢, 尼克

【问题讨论】:

    标签: ibm-cloud ibm-watson retrieve-and-rank


    【解决方案1】:

    好的,这是深夜经历之一。我确信我确实上传了我的 cranfield_data.json 文件,但今天检查它表明我没有上传。 今天运行脚本再次上传,看到确认是关键。

    之后我重复了 train.py 并且一切正常!

    我希望这对其他人也有帮助。

    顺便说一句,就在我第一次尝试更新和重新编译 curl 之前上传。好像我没有配置它使用https,我猜我第一次执行curl上传cranfield_data.json时没有注意。 今天我看到错误“不支持协议“https””,这帮助我理解了之前发生的事情。在我的 Mac 上恢复原来的 curl 解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2016-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多