Back to Tensorflow

tflite_model_maker.question_answer.create

tensorflow/lite/g3doc/api_docs/python/tflite_model_maker/question_answer/create.md

2.21.02.8 KB
Original Source

page_type: reference description: Loads data and train the model for question answer.

<link rel="stylesheet" href="/site-assets/css/style.css"> <!-- DO NOT EDIT! Automatically generated file. --> <div itemscope itemtype="http://developers.google.com/ReferenceObject"> <meta itemprop="name" content="tflite_model_maker.question_answer.create" /> <meta itemprop="path" content="Stable" /> </div>

tflite_model_maker.question_answer.create

<!-- Insert buttons and diff --> <table class="tfo-notebook-buttons tfo-api nocontent" align="left"> <td> <a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/question_answer.py#L193-L232">
View source on GitHub
</a> </td> </table>

Loads data and train the model for question answer.

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link"> <code>@classmethod</code> <code>tflite_model_maker.question_answer.create( train_data, model_spec, batch_size=None, epochs=2, steps_per_epoch=None, shuffle=False, do_train=True ) </code></pre> <h3>Used in the notebooks</h3> <table class="vertical-rules"> <thead> <tr> <th>Used in the tutorials</th> </tr> </thead> <tbody> <tr> <td> <ul> <li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/question_answer">BERT Question Answer with TensorFlow Lite Model Maker</a></li> </ul> </td> </tr> </tbody> </table> <!-- Tabular view --> <table class="responsive fixed orange"> <colgroup><col width="214px"><col></colgroup> <tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr> <tr> <td> `train_data`<a id="train_data"></a> </td> <td> Training data. </td> </tr><tr> <td> `model_spec`<a id="model_spec"></a> </td> <td> Specification for the model. </td> </tr><tr> <td> `batch_size`<a id="batch_size"></a> </td> <td> Batch size for training. </td> </tr><tr> <td> `epochs`<a id="epochs"></a> </td> <td> Number of epochs for training. </td> </tr><tr> <td> `steps_per_epoch`<a id="steps_per_epoch"></a> </td> <td> Integer or None. Total number of steps (batches of samples) before declaring one epoch finished and starting the next epoch. If `steps_per_epoch` is None, the epoch will run until the input dataset is exhausted. </td> </tr><tr> <td> `shuffle`<a id="shuffle"></a> </td> <td> Whether the data should be shuffled. </td> </tr><tr> <td> `do_train`<a id="do_train"></a> </td> <td> Whether to run training. </td> </tr> </table> <!-- Tabular view --> <table class="responsive fixed orange"> <colgroup><col width="214px"><col></colgroup> <tr><th colspan="2"><h2 class="add-link">Returns</h2></th></tr> <tr class="alt"> <td colspan="2"> An instance based on QuestionAnswer. </td> </tr> </table>