# Update train\_dataset after trainer is initialized

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fupdate-train-dataset-after-trainer-is-initialized%2F5135%3E%5C
**Category:** Beginners\
**Created:** [March 27, 2021, 1:16am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fupdate-train-dataset-after-trainer-is-initialized%2F5135 "2021-03-27T01:16:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrRobot](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@MrRobot](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FMrRobot)%5C
**Post date:** [March 27, 2021, 1:16am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fupdate-train-dataset-after-trainer-is-initialized%2F5135%2F1 "2021-03-27T01:16:37Z")

</div>

I am trying to fine-tune BERT for token classification under the low-resource setting, where I am aiming to use as few samples as possible (this setting is also called [active learning](https://en.wikipedia.org/wiki/Active_learning_(machine_learning))). The pipeline is like following

- Step 1: Train on initial labeled training set
- Step 2: Repeat until the annotation budget is reached or performance is good enough
  - Add annotated samples to training set based on some criterion
  - Retrain the model on the previously saved checkpoints

I have tried the following two implementations

- Initialize `Trainer(...)` every time in Step 2. _However_, this will cause the model to fine-tune from scratch and therefore seems to be incorrect.
- Update `train_dataset` after the `Trainer(...)` is initialized. _However_, from the [doc](https://huggingface.co/transformers/main_classes/trainer.html#id1), it seems that there is **no** way to update `train_dataset` after the class is initialized.

Could someone help me with this (two _howevers_). Thank you for any input!
