allenai / allenai/scibert

Tensorflow error when loading checkpoints

Offen
#117 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
1.7k
Forks
232
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I am trying to rebuild the model using tf.official like so:
```
import tensorflow as tf
import official
import json

config_dict = json.loads(tf.io.gfile.GFile('/content/drive/MyDrive/TREC-COVID/scibert_scivocab_uncased/bert_config.json').read())

bert_config = official.nlp.bert.configs.BertConfig.from_dict(config_dict)
bert_model = official.nlp.bert.bert_models.get_transformer_encoder(bert_config)

checkpoint = tf.train.Checkpoint(encoder=bert_model)
checkpoint.read('/content/drive/MyDrive/TREC-COVID/scibert_scivocab_uncased/bert_model.ckpt').assert_consumed()
```

The last line of the code runs into an error:

```
AssertionError Traceback (most recent call last)
in ()
1 checkpoint = tf.train.Checkpoint(encoder=bert_model)
----> 2 checkpoint.read('/content/drive/MyDrive/TREC-COVID/scibert_scivocab_uncased/bert_model.ckpt').assert_consumed()

/usr/local/lib/python3.7/dist-packages/tensorflow/python/training/tracking/util.py in assert_consumed(self)
1000 raise AssertionError(
1001 "Some objects had attributes which were not restored:{}".format(
-> 1002 "".join(unused_attribute_strings)))
1003 for trackable in self._graph_view.list_objects():
1004 # pylint: disable=protected-access

AssertionError: Some objects had attributes which were not restored:

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.