Skip to content

Doctests fail and are not in CI #473

Open
@Garfield100

Description

Hello,

I ran across a mistake in the docs for Part-Of-Speech tagging. The last line contains pos_model.encode_as_tensor(&input) which does not exist. Marking the codeblock as no_run instead of ignore then reveals this when running cargo test --doc:

error[E0599]: no method named `encode_as_tensor` found for struct `POSModel` in the current scope
 --> src/pipelines/mod.rs:416:24
  |
8 | let output = pos_model.encode_as_tensor(&input);
  |                        ^^^^^^^^^^^^^^^^ method not found in `POSModel`

Running that command shows there is another doctest which also fails, however this time it's because cargo test --doc does not enable the hf-tokenizers flag. This is remedied by running cargo test -Fhf-tokenizers --doc instead.

I did try modifying the [package.metadata.docs.rs] tag in Cargo.toml to include it but that did not change anything.

Another idea would be to move the [tokenizer docs](https://github.com/guillaume-be/rust-bert/
blob/411c224cfc427f1b7b7fb6c1e449505427ba3d92/src/pipelines/mod.rs#L477) to the hf-tokenizers module

A cursory search reveals there are other rust code blocks in the docs which are annotated with ignore instead of no_run. cargo test --doc is also not part of the CI pipeline, so even the correctly annotated code examples are never checked.
I believe this is worth changing to ensure the docs are correct and stay in sync with the api.

If you let me know your opinion on this and which way you prefer this fixed I would be happy to contribute and open a PR :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions