I did finetuning for mobilebert_multi_cased_L-24_H-128_B-512_A-4_F-4_OPT with model maker.
But it finish abnormally.
from tflite_model_maker import text_classifier
from tflite_model_maker.config import ExportFormat
from tflite_model_maker.text_classifier import MobileBertClassifierSpec
from tflite_model_maker.text_classifier import DataLoader
I did finetuning for mobilebert_multi_cased_L-24_H-128_B-512_A-4_F-4_OPT with model maker. But it finish abnormally.
from tflite_model_maker import text_classifier from tflite_model_maker.config import ExportFormat from tflite_model_maker.text_classifier import MobileBertClassifierSpec from tflite_model_maker.text_classifier import DataLoader
spec = MobileBertClassifierSpec(uri='https://tfhub.dev/tensorflow/mobilebert_multi_cased_L-24_H-128_B-512_A-4_F-4_OPT/1', model_dir=None, seq_len=128, dropout_rate=0.1, initializer_range = 0.02, learning_rate = 3e-05, distribution_strategy = 'off', num_gpus = -1, tpu = '', trainable = True, do_lower_case = True, is_tf2 = False, name = 'MobileBert', tflite_input_name=None, default_batch_size=48 ) data_dir = os.path.dirname(".\") replace_label(os.path.join(os.path.join(data_dir, 'train.tsv')), 'train.csv') replace_label(os.path.join(os.path.join(data_dir, 'dev.tsv')), 'dev.csv')
train_data = DataLoader.from_csv( filename='train.csv', text_column='sentence', label_column='label', model_spec=spec, is_training=True) test_data = DataLoader.from_csv( filename='dev.csv', text_column='sentence', label_column='label', model_spec=spec, is_training=False)
model = text_classifier.create(train_data, model_spec=spec, epochs=3) ...
Environment -Windows10 -Anaconda2020.07 -Python3.8 -tensorflow2.6.0 -tflite-model-maker0.3.2
Error message is displayed like below. Traceback (most recent call last): File "main.py", line 78, in
model = text_classifier.create(train_data, model_spec=spec, epochs=3)
.........
File "C:xxxxx\lib\site-packages\tensorflow_hub\keras_layer.py", line 309, in _getcallable
raise ValueError("Unknown signature %s in %s (available signatures: %s)."
ValueError: Unknown signature tokens in https://tfhub.dev/tensorflow/mobilebert
multi_cased_L-24_H-128_B-512_A-4_F-4_OPT/1 (available signatures: _SignatureMap({'serving_default': <ConcreteFunction signature_wrapper(*, input_word_ids, input_type_ids, input_mask) at 0x601DDAAD90>})).
I try to do finetuning for uncased_L-24_H-128_B-512_A-4_F-4_OPT(https://tfhub.dev/google/mobilebert/uncased_L-24_H-128_B-512_A-4_F-4_OPT/1) with same source. It finish normally. I can get tflite model. What should I do anything when I use mulit lingual model, ?