💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Add HFTrainer documentation
davidmezzettif0eb46b85dca
diff --git a/docs/pipelines/trainer.md b/docs/pipelines/trainer.mdnew file mode 100644index 00000000..03ac7ef7--- /dev/null+++ b/docs/pipelines/trainer.md@@ -0,0 +1,34 @@+# HFTrainer++Trains a new Hugging Face Transformer model using the Trainer API.++Examples on how to use the trainer below.++```python+import pandas as pd++from datasets import load_dataset++from txtai.pipeline import HFTrainer++trainer = HFTrainer()++# Pandas DataFrame+df = pd.read_csv("training.csv")+model, tokenizer = trainer("bert-base-uncased", df)++# Hugging Face dataset+ds = load_dataset("glue", "sst2")+model, tokenizer = trainer("bert-base-uncased", ds["train"])++# List of dicts+dt = [{"text": "sentence 1", "label": 0}, {"text": "sentence 2", "label": 1}]]+model, tokenizer = trainer("bert-base-uncased", dt)++# Support additional TrainingArguments+model, tokenizer = trainer("bert-base-uncased", dt,+ learning_rate=3e-5, num_train_epochs=5)+```++::: txtai.pipeline.HFTrainer.__init__+::: txtai.pipeline.HFTrainer.__call__diff --git a/mkdocs.yml b/mkdocs.ymlindex cc5f8e96..62a24b49 100644--- a/mkdocs.yml+++ b/mkdocs.yml@@ -40,6 +40,7 @@ nav:- Similarity: pipelines/similarity.md- Summary: pipelines/summary.md- Textractor: pipelines/textractor.md+ - Trainer: pipelines/trainer.md- Transcription: pipelines/transcription.md- Translation: pipelines/translation.md- Workflows: workflows.md