Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctests fail and are not in CI #473

Open
Garfield100 opened this issue Oct 22, 2024 · 0 comments
Open

Doctests fail and are not in CI #473

Garfield100 opened this issue Oct 22, 2024 · 0 comments

Comments

@Garfield100
Copy link

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant