Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
###############
|
| 2 |
+
# Load datasets
|
| 3 |
+
###############
|
| 4 |
+
raw_datasets = get_datasets(data_args, splits=data_args.dataset_splits)
|
| 5 |
+
logger.info(
|
| 6 |
+
f"Training on the following datasets and their proportions: {[split + ' : ' + str(dset.num_rows) for split, dset in raw_datasets.items()]}"
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
################
|
| 10 |
+
# Load tokenizer
|
| 11 |
+
################
|
| 12 |
+
tokenizer = get_tokenizer(model_args, data_args)
|
| 13 |
+
|
| 14 |
+
#####################
|
| 15 |
+
# Apply chat template
|
| 16 |
+
#####################
|
| 17 |
+
raw_datasets = raw_datasets.map(apply_chat_template, fn_kwargs={"tokenizer": tokenizer, "task": "sft"})
|
| 18 |
+
train_dataset = raw_datasets["train"]
|
| 19 |
+
eval_dataset = raw_datasets["test"]
|