Views
No views yet
distilbert-base-uncased backbone and is capable of performing two tasks simultaneously:schedule, cancel).appointment_type).distilbert-base-uncased model as its core feature extractor. Two custom classification "heads" are placed on top of this base to perform the downstream tasks.distilbert-base-uncasedclinc/clinc_oos (for simple intents) and synthetically generated, template-based examples for complex scheduling intents.clinc/clinc_oos were down-sampled to a maximum of 150 examples each.schedule, reschedule, etc.), Contextual Word Replacement was used. A distilbert-base-uncased model augmented the templates by replacing non-placeholder words with contextually relevant synonyms.schedule, reschedule, cancel, query_avail, greeting, positive_reply, negative_reply, bye, oos (out-of-scope).practitioner_name, appointment_type, appointment_id.distilbert-base-uncased base model was entirely frozen.1# Define a data collator to handle padding for token classification
2data_collator = DataCollatorForTokenClassification(tokenizer=tokenizer)
3# Define Training Arguments
4training_args = TrainingArguments(
5 output_dir="path/to/output_dir",
6 overwrite_output_dir=True,
7 num_train_epochs=200, # Training epochs
8 per_device_train_batch_size=32,
9 per_device_eval_batch_size=32,
10 learning_rate=1e-4, # Learning Rate
11 weight_decay=1e-5, # AdamW weight decay
12 logging_dir="path/to/logging_dir",
13 logging_strategy="epoch",
14 eval_strategy="epoch",
15 save_strategy="epoch",
16 load_best_model_at_end=True,
17 metric_for_best_model="eval_loss", # Focus on validation loss as the key metric
18 # --- Hub Arguments ---
19 push_to_hub=True,
20 hub_model_id=hub_model_id,
21 hub_strategy="end",
22 hub_token=hf_token,
23 report_to="tensorboard" # Tensorboard to monitor training
24)
25# Create the Trainer
26trainer = Trainer(
27 model=model,
28 args=training_args,
29 train_dataset=processed_datasets["train"],
30 eval_dataset=processed_datasets["validation"],
31 processing_class=tokenizer,
32 data_collator=data_collator,
33 compute_metrics=compute_metrics, # Custom function (check how_to_use.md)
34 callbacks=[EarlyStoppingCallback(early_stopping_patience=10)]
35)1# Define Training Arguments
2training_args = TrainingArguments(
3 output_dir="path/to/output_dir",
4 overwrite_output_dir=True,
5 num_train_epochs=50, # Fine-tuning epochs
6 per_device_train_batch_size=32,
7 per_device_eval_batch_size=32,
8 learning_rate=1e-6, # Learning Rate
9 weight_decay=1e-3, # AdamW weight decay
10 logging_dir="path/to/logging_dir",
11 logging_strategy="epoch",
12 eval_strategy="epoch",
13 save_strategy="epoch",
14 load_best_model_at_end=True,
15 metric_for_best_model="eval_loss", # Focus on NER F1 as the key metric
16 # --- Hub Arguments ---
17 push_to_hub=True,
18 hub_model_id=hub_model_id,
19 hub_strategy="end",
20 hub_token=hf_token,
21 report_to="tensorboard" # Tensorboard to monitor training
22)
23# Create the Trainer
24trainer = Trainer(
25 model=model,
26 args=training_args,
27 train_dataset=processed_datasets["train"],
28 eval_dataset=processed_datasets["validation"],
29 processing_class=tokenizer,
30 data_collator=data_collator,
31 compute_metrics=compute_metrics, # Custom function (check how_to_use.md)
32 callbacks=[EarlyStoppingCallback(early_stopping_patience=5)]
33)| Intent | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
| bye | 0.9500 | 0.8261 | 0.8837 | 23 |
| cancel | 0.9211 | 0.8434 | 0.8805 | 83 |
| greeting | 0.9545 | 0.9545 | 0.9545 | 22 |
| negative_reply | 0.9091 | 0.9091 | 0.9091 | 22 |
| oos | 1.0000 | 0.8696 | 0.9302 | 23 |
| positive_reply | 0.7407 | 0.9091 | 0.8163 | 22 |
| query_avail | 0.9620 | 0.9383 | 0.9500 | 81 |
| reschedule | 0.8506 | 0.8916 | 0.8706 | 83 |
| schedule | 0.8488 | 0.9125 | 0.8795 | 80 |
| --- | --- | --- | --- | ---- |
| Accuracy | 0.8952 | 439 | ||
| Macro Avg | 0.9041 | 0.8949 | 0.8972 | 439 |
| Weighted Avg | 0.8998 | 0.8952 | 0.8960 | 439 |
| Entity | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
| B-appointment_id | 1.0000 | 1.0000 | 1.0000 | 61 |
| B-appointment_type | 0.8646 | 0.7477 | 0.8019 | 111 |
| B-practitioner_name | 0.9161 | 0.9467 | 0.9311 | 150 |
| I-appointment_id | 0.9667 | 0.9667 | 0.9667 | 210 |
| I-appointment_type | 0.8182 | 0.7368 | 0.7754 | 171 |
| I-practitioner_name | 0.9540 | 0.8941 | 0.9231 | 255 |
| O | 0.9782 | 0.9892 | 0.9837 | 3813 |
| --- | --- | --- | --- | ---- |
| Accuracy | 0.9673 | 4771 | ||
| Macro Avg | 0.9283 | 0.8973 | 0.9117 | 4771 |
| Weighted Avg | 0.9664 | 0.9673 | 0.9666 | 4771 |
distilbert-base-uncased model and the clinc/clinc_oos dataset.