Spaces:
Sleeping
Sleeping
Update my_model/fine_tuner/fine_tuner.py
Browse files
my_model/fine_tuner/fine_tuner.py
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
# OK-VQA dataset.
|
17 |
|
18 |
# Ensure all dependencies are installed and the required files are in place before running this script.
|
19 |
-
# The configurations for the fine-tuning process are defined in the 'fine_tuning_config.py' file.
|
20 |
|
21 |
# ---------- Please run this file for the full fine-tuning process to start ----------#
|
22 |
# ---------- Please ensure this is run on a GPU ----------#
|
@@ -302,6 +302,11 @@ def fine_tune(save_fine_tuned_adapter=False, merge=False, delete_trainer_after_f
|
|
302 |
This function encompasses the complete workflow of fine-tuning, including data handling, training,
|
303 |
and optional steps like saving the fine-tuned model and merging weights.
|
304 |
|
|
|
|
|
|
|
|
|
|
|
305 |
Args:
|
306 |
save_fine_tuned_adapter (bool): If True, saves the fine-tuned adapter after training.
|
307 |
merge (bool): If True, merges the weights of the fine-tuned adapter into the base model.
|
@@ -311,10 +316,6 @@ def fine_tune(save_fine_tuned_adapter=False, merge=False, delete_trainer_after_f
|
|
311 |
The fine-tuned model after the fine-tuning process. This could be either the merged model
|
312 |
or the trained model based on the provided arguments.
|
313 |
|
314 |
-
The function initiates by preparing the training and evaluation datasets using the `FinetuningDataHandler`.
|
315 |
-
It then sets up the QLoRA configuration for the fine-tuning process. The actual training is carried out by
|
316 |
-
the `Finetuner` class. Post training, based on the arguments, the function can save the fine-tuned model,
|
317 |
-
merge the adapter weights with the base model, and clean up resources by deleting the trainer object.
|
318 |
"""
|
319 |
|
320 |
data_handler = FinetuningDataHandler()
|
@@ -344,4 +345,5 @@ def fine_tune(save_fine_tuned_adapter=False, merge=False, delete_trainer_after_f
|
|
344 |
|
345 |
|
346 |
if __name__ == "__main__":
|
347 |
-
|
|
|
|
16 |
# OK-VQA dataset.
|
17 |
|
18 |
# Ensure all dependencies are installed and the required files are in place before running this script.
|
19 |
+
# The configurations for the fine-tuning process are defined in the 'my_model/config/fine_tuning_config.py' file.
|
20 |
|
21 |
# ---------- Please run this file for the full fine-tuning process to start ----------#
|
22 |
# ---------- Please ensure this is run on a GPU ----------#
|
|
|
302 |
This function encompasses the complete workflow of fine-tuning, including data handling, training,
|
303 |
and optional steps like saving the fine-tuned model and merging weights.
|
304 |
|
305 |
+
The function initiates by preparing the training and evaluation datasets using the `FinetuningDataHandler`.
|
306 |
+
It then sets up the QLoRA configuration for the fine-tuning process. The actual training is carried out by
|
307 |
+
the `Finetuner` class. Post training, based on the arguments, the function can save the fine-tuned model,
|
308 |
+
merge the adapter weights with the base model, and clean up resources by deleting the trainer object.
|
309 |
+
|
310 |
Args:
|
311 |
save_fine_tuned_adapter (bool): If True, saves the fine-tuned adapter after training.
|
312 |
merge (bool): If True, merges the weights of the fine-tuned adapter into the base model.
|
|
|
316 |
The fine-tuned model after the fine-tuning process. This could be either the merged model
|
317 |
or the trained model based on the provided arguments.
|
318 |
|
|
|
|
|
|
|
|
|
319 |
"""
|
320 |
|
321 |
data_handler = FinetuningDataHandler()
|
|
|
345 |
|
346 |
|
347 |
if __name__ == "__main__":
|
348 |
+
# uncomment to run the fine-tuning process.
|
349 |
+
#fine_tune()
|