【问题标题】:Xgboost dump and load issuesXgboost 转储和加载问题
【发布时间】:2022-12-08 08:18:00
【问题描述】:

我在 amazon sagemaker 上训练了我的 xgboost 管道模型并将文件保存在本地:

pickle.dump(model, open(file_name, "wb"))

然后移动到本地计算机以在推理模式下使用模型:

pickle.load(open(file_name, "rb"))

XGBoostError: [11:45:49] ../src/common/json.cc:458: Expecting: """, got: "76 ", around character position: 1
    {L\0\0\0\0\0\0\0
    ^~~~~~~~~
Stack trace:
  [bt] (0) 1   libxgboost.dylib                    0x00000001258a9a54 dmlc::LogMessageFatal::~LogMessageFatal() + 116
  [bt] (1) 2   libxgboost.dylib                    0x00000001258d69be xgboost::JsonReader::Error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) const + 1054
  [bt] (2) 3   libxgboost.dylib                    0x00000001258d7427 xgboost::JsonReader::Expect(char, char) + 279
  [bt] (3) 4   libxgboost.dylib                    0x00000001258d7bfb xgboost::JsonReader::ParseObject() + 331
  [bt] (4) 5   libxgboost.dylib                    0x00000001258d6467 xgboost::JsonReader::Parse() + 439
  [bt] (5) 6   libxgboost.dylib                    0x00000001258dbfbe xgboost::Json::Load(xgboost::StringView) + 62
  [bt] (6) 7   libxgboost.dylib                    0x0000000125960b93 xgboost::LearnerIO::Load(dmlc::Stream*) + 435
  [bt] (7) 8   libxgboost.dylib                    0x00000001258b510f XGBoosterUnserializeFromBuffer + 159
  [bt] (8) 9   libffi.7.dylib                      0x000000010f72bead ffi_call_unix64 + 85

在 sagemaker 上使用的包版本:xgboost==1.6.1

【问题讨论】:

  • 你解决了吗?我有同样的问题...
  • 也有同样的问题。写这个看看是否有解决方案的更新
  • 仍然没有更新:(

标签: python pickle xgboost


【解决方案1】:

将 xgboost 更新到 1.7.1 即可解决问题

【讨论】:

    猜你喜欢
    • 2020-10-04
    • 2015-12-16
    • 1970-01-01
    • 2022-06-23
    • 2022-01-11
    • 2020-09-07
    • 1970-01-01
    • 2016-03-27
    • 2011-03-16
    相关资源
    最近更新 更多