H2OResponseErrorH2OResponseError:服务器错误java.lang.IllegalArgumentException:

时间:2019-04-26 19:20:51

标签: python nlp h2o

嗨,从NLP与H2O教程运行AmazonReviews教程时遇到此错误

http://docs.h2o.ai/h2o-tutorials/latest-stable/h2o-world-2017/nlp/index.html

当我尝试运行时:

# Train Word2Vec Model
from h2o.estimators.word2vec import H2OWord2vecEstimator

# This takes time to run - left commented out
#w2v_model = H2OWord2vecEstimator(vec_size = 100, model_id = "w2v.hex")
#w2v_model.train(training_frame=words)

# Pre-trained model available on s3: https://s3.amazonaws.com/tomk/h2o-world/megan/w2v.hex
w2v_model = h2o.load_model("https://s3.amazonaws.com/tomk/h2o-world/megan/w2v.hex")

我收到以下错误:

---------------------------------------------------------------------------
H2OResponseError                          Traceback (most recent call last)
<ipython-input-22-a55d2503e18d> in <module>
      7 
      8 # Pre-trained model available on s3: https://s3.amazonaws.com/tomk/h2o-world/megan/w2v.hex
----> 9 w2v_model = h2o.load_model("https://s3.amazonaws.com/tomk/h2o-world/megan/w2v.hex")

~\Anaconda3\lib\site-packages\h2o\h2o.py in load_model(path)
    989     """
    990     assert_is_type(path, str)
--> 991     res = api("POST /99/Models.bin/%s" % "", data={"dir": path})
    992     return get_model(res["models"][0]["model_id"]["name"])
    993 

~\Anaconda3\lib\site-packages\h2o\h2o.py in api(endpoint, data, json, filename, save_to)
    101     # type checks are performed in H2OConnection class
    102     _check_connection()
--> 103     return h2oconn.request(endpoint, data=data, json=json, filename=filename, save_to=save_to)
    104 
    105 

~\Anaconda3\lib\site-packages\h2o\backend\connection.py in request(self, endpoint, data, json, filename, save_to)
    400                                     auth=self._auth, verify=self._verify_ssl_cert, proxies=self._proxies)
    401             self._log_end_transaction(start_time, resp)
--> 402             return self._process_response(resp, save_to)
    403 
    404         except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError) as e:

~\Anaconda3\lib\site-packages\h2o\backend\connection.py in _process_response(response, save_to)
    723         # Client errors (400 = "Bad Request", 404 = "Not Found", 412 = "Precondition Failed")
    724         if status_code in {400, 404, 412} and isinstance(data, (H2OErrorV3, H2OModelBuilderErrorV3)):
--> 725             raise H2OResponseError(data)
    726 
    727         # Server errors (notably 500 = "Server Error")

H2OResponseError: Server error java.lang.IllegalArgumentException:
  Error: Cannot find persist manager for scheme https
  Request: POST /99/Models.bin/
    data: {'dir': 'https://s3.amazonaws.com/tomk/h2o-world/megan/w2v.hex'}

1 个答案:

答案 0 :(得分:0)

实际上我想我已经知道了。如果您正在运行本教程,请不要尝试下载文件。只需取消注释以下几行

从这里:

# This takes time to run - left commented out
#w2v_model = H2OWord2vecEstimator(vec_size = 100, model_id = "w2v.hex")
#w2v_model.train(training_frame=words)

对此:

# This takes time to run - left commented out
w2v_model = H2OWord2vecEstimator(vec_size = 100, model_id = "w2v.hex")
w2v_model.train(training_frame=words)

希望这可以帮助某人:)