Skip to content

Commit a850118

Browse files
authored
Upd/tutorials (#252)
* rename zero-shot presets * small fixes * upd concepts a little bit * update basic data tutorial * update advanced data usage guide * update modules user guide * add embedder configuration guide * minor fixes * upd automl guide * fix guides runtime errors * minor changes * minor fix * fix f-string * try to fix typing
1 parent c6681e7 commit a850118

File tree

21 files changed

+954
-307
lines changed

21 files changed

+954
-307
lines changed

autointent/_dump_tools/unit_dumpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ def dump(obj: PeftModel, path: Path, exists_ok: bool) -> None:
215215
ptuning_path = path / "ptuning"
216216
ptuning_path.mkdir(parents=True, exist_ok=exists_ok)
217217
obj.save_pretrained(str(ptuning_path / "peft"))
218-
obj.base_model.save_pretrained(ptuning_path / "base_model") # type: ignore[attr-defined]
218+
obj.base_model.save_pretrained(ptuning_path / "base_model")
219219
else:
220220
# strategy to save lora models: merge adapters and save as usual hugging face model
221221
lora_path = path / "lora"
222222
lora_path.mkdir(parents=True, exist_ok=exists_ok)
223223
merged_model: PreTrainedModel = obj.merge_and_unload()
224-
merged_model.save_pretrained(lora_path) # type: ignore[attr-defined]
224+
merged_model.save_pretrained(lora_path)
225225

226226
@staticmethod
227227
def load(path: Path, **kwargs: Any) -> PeftModel: # noqa: ANN401, ARG004
@@ -248,7 +248,7 @@ class HFModelDumper(BaseObjectDumper[PreTrainedModel]):
248248
@staticmethod
249249
def dump(obj: PreTrainedModel, path: Path, exists_ok: bool) -> None:
250250
path.mkdir(parents=True, exist_ok=exists_ok)
251-
obj.save_pretrained(path) # type: ignore[attr-defined]
251+
obj.save_pretrained(path)
252252

253253
@staticmethod
254254
def load(path: Path, **kwargs: Any) -> PreTrainedModel: # noqa: ANN401, ARG004
@@ -265,7 +265,7 @@ class HFTokenizerDumper(BaseObjectDumper[PreTrainedTokenizer | PreTrainedTokeniz
265265
@staticmethod
266266
def dump(obj: PreTrainedTokenizer | PreTrainedTokenizerFast, path: Path, exists_ok: bool) -> None:
267267
path.mkdir(parents=True, exist_ok=exists_ok)
268-
obj.save_pretrained(path) # type: ignore[union-attr]
268+
obj.save_pretrained(path)
269269

270270
@staticmethod
271271
def load(path: Path, **kwargs: Any) -> PreTrainedTokenizer | PreTrainedTokenizerFast: # noqa: ANN401, ARG004
File renamed without changes.

autointent/custom_types/_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class Split:
124124
"transformers-heavy",
125125
"transformers-light",
126126
"transformers-no-hpo",
127-
"zero-shot-openai",
128-
"zero-shot-transformers",
127+
"zero-shot-llm",
128+
"zero-shot-encoders",
129129
]
130130
"""Some presets that our library supports."""

autointent/modules/scoring/_bert.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def _train(self, tokenized_dataset: DatasetDict) -> None:
181181
load_best_model_at_end=self.early_stopping_config.metric is not None,
182182
)
183183

184-
trainer = Trainer( # type: ignore[no-untyped-call]
184+
trainer = Trainer(
185185
model=self._model,
186186
args=training_args,
187187
train_dataset=tokenized_dataset["train"],
@@ -192,10 +192,10 @@ def _train(self, tokenized_dataset: DatasetDict) -> None:
192192
callbacks=self._get_trainer_callbacks(),
193193
)
194194
if not self.print_progress:
195-
trainer.remove_callback(PrinterCallback) # type: ignore[attr-defined]
196-
trainer.remove_callback(ProgressCallback) # type: ignore[attr-defined]
195+
trainer.remove_callback(PrinterCallback)
196+
trainer.remove_callback(ProgressCallback)
197197

198-
trainer.train() # type: ignore[attr-defined]
198+
trainer.train()
199199

200200
def _get_trainer_callbacks(self) -> list[TrainerCallback]:
201201
res: list[TrainerCallback] = []

docs/source/concepts.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ AutoIntent's architecture centers around transformer-based text embeddings, prov
6060

6161
.. _concepts-multiclass-multilabel:
6262

63-
Classification Paradigms
64-
========================
63+
Multi- vs. Single-label classification
64+
======================================
6565

6666
AutoIntent supports various classification scenarios through its flexible decision module:
6767

6868
**🏷️ Multi-Class Classification**
69-
Traditional single-label classification where each input belongs to exactly one class. Uses argmax or threshold-based decisions on predicted probabilities.
69+
Each input gets assigned to exactly one category - like sorting emails into "Spam", "Work", or "Personal" folders. Common examples include sentiment analysis (positive/negative/neutral) or determining user intent where each message has a single purpose. The model picks the single best match from all possible categories.
7070

7171
**🔖 Multi-Label Classification**
72-
Each input can belong to multiple classes simultaneously. Employs adaptive thresholding strategies that can be sample-specific or learned globally across the dataset.
72+
Each input can belong to multiple categories at once - like tagging a news article as both "Politics" and "Economics". Essential for scenarios like multi-intent messages ("book a flight and check weather"), content tagging, or any situation where multiple labels can apply simultaneously. The model almost independently decides whether each possible category fits or not.
7373

7474

7575
.. _concepts-oos:

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"sphinx.ext.intersphinx",
5151
"sphinx_multiversion",
5252
"sphinx.ext.napoleon",
53-
"sphinx_toolbox.collapse"
53+
"sphinx_toolbox.collapse",
5454
]
5555

5656
templates_path = ["_templates"]

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Reference
6565
:doc:`🔧 API Reference <autoapi/autointent/index>`
6666
Complete technical documentation for all classes, methods, and functions. Essential reference for developers integrating AutoIntent into their applications.
6767

68-
Key sections: :doc:`Modules <autoapi/autointent/modules/index>` | :doc:`Metrics <autoapi/autointent/metrics/index>`
68+
Key section: :doc:`Modules <autoapi/autointent/modules/index>`
6969

7070

7171
.. toctree::

docs/source/learn/automl_theory.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ AutoIntent provides presets that balance different objectives:
173173
pipeline_heavy = Pipeline.from_preset("classic-heavy") # Performance-focused
174174
175175
# Different model types
176-
pipeline_zero_shot = Pipeline.from_preset("zero-shot-transformers") # No training data
176+
pipeline_zero_shot = Pipeline.from_preset("zero-shot-encoders") # No training data
177177
178178
Bayesian Optimization Theory
179179
-----------------------------

docs/source/learn/optimization.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,13 @@ This is one of the ways to solve the problem of an overwhelming number of combin
2525

2626
This algorithm checks fewer combinations, which speeds up the process. To implement such an algorithm, it is necessary to be able to evaluate the quality of not only the final prediction of the entire pipeline but also its intermediate predictions. The main drawback of this approach is that the decisions made are optimal only locally, not globally. The metrics for evaluating intermediate predictions are only a proxy signal for the quality of the final prediction.
2727

28-
This approach has been available in our library since release v0.0.1.
29-
3028
Random Search
3129
-------------
3230

3331
A simpler strategy is to take a random subset of the full search space (random grid search). A straightforward strategy is to iterate through all combinations in random order until a certain time budget is exhausted.
3432

3533
This approach is less intelligent than the greedy strategy because, at any moment during the random combination search, poor embedders or any other bad parameters might keep appearing, despite they have been tested already. The greedy strategy would have eliminated such embedders at the beginning and not revisited them. On the other hand, random search, by its nature, does not rely on any local decisions.
3634

37-
The implementation of this optimization method is planned for release v0.1.0.
38-
3935
Bayesian Optimization
4036
---------------------
4137

0 commit comments

Comments
 (0)