google-research / albert

ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
Apache License 2.0
3.23k stars 571 forks source link

Error creating and exporting TFLite after fine-tuning (using run_squad_v1.py/run_squad_v2.py) #227

Open manojpreveen opened 4 years ago

manojpreveen commented 4 years ago

python -m albert.run_squad_v1 \ --albert_config_file=albert/assets/albert_config.json \ --output_dir=albert/output \ --train_file=albert/train-v1.1.json \ --predict_file=albert/dev-v1.1.json \ --train_feature_file=albert/output/train.tfrecord \ --predict_feature_file=albert/output/dev.tfrecord \ --predict_feature_left_file=albert/output/pred_left_file_example.pkl \ --albert_hub_module_handle=https://tfhub.dev/google/albert_base/1 \ --spm_model_file=albert/assets/30k-clean.model \ --do_lower_case \ --max_seq_length=384 \ --doc_stride=128 \ --max_query_length=64 \ --do_train=true \ --do_predict=false \ --train_batch_size=16 \ --predict_batch_size=8 \ --learning_rate=5e-5 \ --num_train_epochs=2.0 \ --warmup_proportion=.1 \ --save_checkpoints_steps=5000 \ --n_best_size=20 \ --max_answer_length=128 \ --export_dir=albert/modelite

The above is the command I ran to finetune Albert-Base on SQuAD1.1 The finetune was successful and I got both tensorflow checkpoints and the model in saved_model format.

When the Conversion of saved_model to TFLite Model step starts, it's throwing out an error as below :

File "/usr/local/share/anaconda3/lib/python3.7/site-packages/tensorflow_core/lite/python/convert_saved_model.py", line 194, in freeze_saved_model raise ValueError("SavedModels with assets/ directory are not supported.") ValueError: SavedModels with assets/ directory are not supported.

Is it just happening for me or is it not supported by tensorflow itself yet. Is there any workaround to create TFLite model. Please Help.

Thanks.

taylorshin commented 3 years ago

I'm having a similar problem. We would greatly appreciate some help/guidance!

PantherYan commented 3 years ago

We also meet this issue, any solutions?