Skip to content

Commit

Permalink
test/document list-tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
rectalogic committed Oct 3, 2024
1 parent 8c39372 commit 65f503a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ See the documentation for a specific pipeline for information on additional keyw

## Transformer Pipeline Tasks

You can list available tasks with:
```sh-session
$ llm transformers list-tasks
```

### [audio-classification](https://huggingface.co/docs/transformers/en/main_classes/pipelines#transformers.AudioClassificationPipeline)

The `audio-classification` task takes an audio URL or path, for example:
Expand Down
9 changes: 9 additions & 0 deletions tests/test_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,3 +658,12 @@ def test_transformer(monkeypatch, capsys, llm_args, validator):
def test_plugin_is_installed():
names = [mod.__name__ for mod in pm.get_plugins()]
assert "llm_transformers" in names


def test_list_tasks(monkeypatch, capsys):
monkeypatch.setattr(sys, "argv", ["llm", "transformers", "list-tasks"])
monkeypatch.setattr(sys.stdin, "isatty", lambda: True) # prevent llm from trying to read from stdin
monkeypatch.setattr(sys, "exit", lambda x=None: None)
cli()
captured = capsys.readouterr()
assert "text-generation" in captured.out

0 comments on commit 65f503a

Please sign in to comment.