trainable-tagger-default

Train and use an AutoML tagger with Google Vertex AI. Just specify which tags in Steamship to train on, then generate more of the same.

Using

Tagger Plugins add annotations to text that can be queried and composed later.

Blockifiers convert data into Steamship’s native Block format.

Importer Plugins add annotations to text that can be queried and composed later.

Use them when writing Packages to help you work with data of different types.

Links

from steamship import Steamship, File

client = Steamship(workspace="my-workspace-handle")

# Import a file to Steamship
with open("file.ext") as f:
  file = File.create(content=file.read())

# Create an instance of this blockifier
blockifier = client.use_plugin(
  'trainable-tagger-default'
)

# Blockify the file
task = file.blockify()
task.wait()
from steamship import Steamship, File

client = Steamship(workspace="my-workspace-handle")

# Import a file to Steamship
with open("file.ext") as f:
  file = File.create(content=file.read())

# Create a blockifier. We'll assume Markdown here.
blockifier = client.use_plugin(
  'markdown-blockifier-default'
)

# Blockify the file
task = file.blockify()

# Create an instance of this tagger.
tagger = client.use_plugin(
  'trainable-tagger-default'
)

# Tag the file
task = file.tag()

task.wait()
Pulled from the GitHub repository.
# Vertex AI Classifier (trainable-tagger-default)

This project contains a Steamship Tagger that trains an AutoML classifier using Vertex AI and applies it to new blocks. 

## Configuration

This plugin must be configured with the following fields:

| Parameter | Description | DType | Required |
|-------------------|----------------------------------------------------|--------|--|
| single_or_multi_label | Whether to output single or multiple labels | string | True |
| tag_kind | The `kind` field for tags to output. Tag name will be the output label. | boolean | True |
| include_tag_names | Whether to train on a subset of tag names (csv string). If empty, all tags of the provided kind will be used for training | boolean | False |

## Getting Started

### Usage

To authenticate with Steamship, install the Steamship CLI with:

```bash
> npm install -g @steamship/cli
```

And then login with:

```bash
> ship login
```

Finally, use the Tagger:

```python
from steamship import Steamship
from steamship.plugin.inputs.training_parameter_plugin_input import TrainingParameterPluginInput
from steamship.plugin.inputs.export_plugin_input import ExportPluginInput

ship = Steamship()  # Without arguments, credentials in ~/.steamship.json will be used.

exporter = ship.use_plugin('signed-url-exporter')
tagger = ship.use_plugin('trainable-tagger-default', config={
  "single_or_multi_label": "single",
  "tag_kind": "classification"
})

# Add tagged files to Steamship

# Now train the plugin
training_request = TrainingParameterPluginInput(
    plugin_instance=tagger.handle,
    export_plugin_input=ExportPluginInput(
        plugin_instance=exporter.handle, type="file", query="blocktag",
    ),
    training_params={},
)

train_result = tagger.train(training_request)

# This plugin will take approximately 6 hours to train end-to-end -- this is a result of
# how Google Vertex AI works. When it is complete, the task status will be reported as .succeeded.

tag_task = tagger.tag("I like how easy this is!")

```

Steamship is building the fastest way to ship language AI.

Stop building and start shipping. Reach out to get onboarded.
Read More