bert4keras
bert4keras copied to clipboard
如何加载英文robert-large模型
提问时请尽可能提供如下信息:
基本信息
- 你使用的操作系统ubuntu:
- 你使用的Python3.7版本:
- 你使用的Tensorflow1.14版本:
- 你使用的Keras2.3.1版本:
- 你使用的bert4keras0.10.6版本:
- 你使用纯keras:
核心代码
model = build_transformer_model(config_path, checkpoint_path, model=’roberta’)
输出
tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file /home/tguser/lz/pretrainModels/torch/eng/roberta_large/tf_model.h5: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
自我尝试
尝试将huggingface robertalarge 模型tf_model.h5作为checkpoint加载,把vocab.json转为txt形式加载tokenizer
但是报错信息,loadcheckpoint似乎不能够加载h5
如果想要使用roberta-large英文的模型要如何加载呢 https://github.com/pytorch/fairseq/blob/main/examples/roberta/README.md
暂时不支持英文版roberta加载(捂脸)。
因为它没中文权重,而我不做非中文任务,所以开发时就没考虑......
我抽空补充一下吧。
好的好的,谢谢