cannot load weights of bert model when i use multiple targets (target sequence)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- python
调研方向
Reproduce the failure with BERT_Model.load_weights in dlpy/transformers/bert_model.py using the multiple-target call shown. Trace the handoff through dlpy/network.py, especially load_weights_from_keras and load_weights_from_file, and inspect how the target sequence is rejected. Done means multi-target BERT weights load successfully, or the unsupported configuration is explicitly documented.
由索引模型根据 Issue 内容生成。
描述
i have project where i have to predict multiple keywords based on description of a movie.
I am able to train the bert model with 1 (binary target) , but I have train the model with multiple (431) binary targets.
I got an error when I try to load the weight to cas.
parameter:
-
Final classification layer number of class predictions n_classes = 2. (but i tried as well with 1 (regression)
-
Number of target variables (num_tgt_var = 435)
bert.load_weights('/opt/sas/viya/config/data/cas/default/public/bert-base-uncased.kerasmodel.h5' ,
num_target_var=num_tgt_var,
# Do not freeze base model weights.
# Allow layer updates with model tuning.
freeze_base_model=False
)
error:
ERROR: Target sequence for text input is not supported.
ERROR: The action stopped due to errors.
DLPyError Traceback (most recent call last)
Input In [17], in <cell line: 1>()
----> 1 bert.load_weights('/opt/sas/viya/config/data/cas/default/public/bert-base-uncased.kerasmodel.h5' ,
2 num_target_var=num_tgt_var,
3 # Do not freeze base model weights.
4 # Allow layer updates with model tuning.
5 freeze_base_model=False
6 )
File ~/python-dlpy/dlpy/transformers/bert_model.py:967, in BERT_Model.load_weights(self, path, num_target_var, freeze_base_model, use_gpu, last_frozen_layer)
964 data_spec = self.get_data_spec(num_target_var)
966 # attach layer weights
--> 967 super(BERT_Model, self).load_weights(path,
968 data_spec=data_spec,
969 use_gpu=use_gpu,
970 embedding_dim=self._config['hidden_size'])
972 # determine which layers to freeze
973 self._freeze_layers = self._rnn_layer
File ~/python-dlpy/dlpy/network.py:1003, in Network.load_weights(self, path, labels, data_spec, label_file_name, label_length, use_gpu, embedding_dim)
1000 self.load_weights_from_caffe(path, labels=labels, data_spec=data_spec, label_file_name=label_file_name,
1001 label_length=label_length)
1002 elif file_name.lower().endswith('kerasmodel.h5'):
-> 1003 self.load_weights_from_keras(path, labels=labels, data_spec=data_spec, label_file_name=label_file_name,
1004 label_length=label_length, use_gpu=use_gpu, embedding_dim=embedding_dim)
1005 elif file_name.lower().endswith('onnxmodel.h5'):
1006 self.load_weights_from_keras(path, labels=labels, data_spec=data_spec, label_file_name=label_file_name,
1007 label_length=label_length, use_gpu=use_gpu, embedding_dim=embedding_dim)
File ~/python-dlpy/dlpy/network.py:1077, in Network.load_weights_from_keras(self, path, labels, data_spec, label_file_name, label_length, use_gpu, embedding_dim)
1073 self.load_weights_from_file_with_labels(path=path, format_type='KERAS', data_spec=data_spec,
1074 label_file_name=label_file_name, label_length=label_length,
1075 use_gpu=use_gpu, embedding_dim=embedding_dim)
1076 else:
-> 1077 self.load_weights_from_file(path=path, format_type='KERAS', data_spec=data_spec, use_gpu=use_gpu,
1078 embedding_dim=embedding_dim)
File ~/python-dlpy/dlpy/network.py:1187, in Network.load_weights_from_file(self, path, format_type, data_spec, use_gpu, embedding_dim)
1185 for msg in rt.messages:
1186 print(msg)
-> 1187 raise DLPyError('Cannot import model weights, there seems to be a problem.')
1189 # create attributes if necessary
1190 if not has_data_spec:
DLPyError: Cannot import model weights, there seems to be a problem.
- 主要语言
- Python
- 星标
- 224
- 派生
- 129
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sassoftware/python-dlpy 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
sassoftware/python-dlpy#411 ·
-
难度 4/5 3-5 天 新手友好度 25/100
sassoftware/python-dlpy#402 · 16 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
sassoftware/python-dlpy#376 ·
-
Export ONNX未关闭
难度 3/5 1-2 天 新手友好度 35/100
sassoftware/python-dlpy#331 · 5 条评论 ·
-
难度 3/5 1-2 天 新手友好度 38/100
sassoftware/python-dlpy#280 · 4 条评论 ·
查看 sassoftware/python-dlpy 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
its-me-prash/vwgroup-connect-ha#2019 ·
维护者通常 1 天内回复
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 86/100
KonstantinStarovoytov/kitden#21 ·
维护者通常 1 天内回复
-
Refactor未关闭
难度 2/5 1-3 小时 新手友好度 62/100
ehmatthes/gh-profiler#166 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
smart-on-fhir/smart-fetch#73 ·
-
good first issue help wanted
难度 1/5 1-3 小时 新手友好度 85/100
RizgarOzan/playcal#13 ·