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

README.md contains non-functional code #1633

Open
ahenkes1 opened this issue Sep 19, 2024 · 2 comments
Open

README.md contains non-functional code #1633

ahenkes1 opened this issue Sep 19, 2024 · 2 comments

Comments

@ahenkes1
Copy link

The README.md (and the corresponding landing page of the documentation) contains non-functional code. Specifically the following:

Loading a pretrained tokenizer from the Hub

use tokenizers::tokenizer::{Result, Tokenizer};

fn main() -> Result<()> {
    # #[cfg(feature = "http")]
    # {
        let tokenizer = Tokenizer::from_pretrained("bert-base-cased", None)?;

        let encoding = tokenizer.encode("Hey there!", false)?;
        println!("{:?}", encoding.get_tokens());
    # }
    Ok(())
}

Here, the function to load the tokenizer from a pretrained model is not available in 'Tokenizer':

error[E0599]: no function or associated item named `from_pretrained` found for struct `Tokenizer` in the current scope
   --> src/main.rs:30:32
    |
30  |     let tokenizer = Tokenizer::from_pretrained("bert-base-cased", None);
    |                                ^^^^^^^^^^^^^^^ function or associated item not found in `Tokenizer`
@ArthurZucker
Copy link
Collaborator

Hey! You have to enbale the https features for that 🤗 Should we clarify the doc about this?

@ahenkes1
Copy link
Author

Hey! That makes sense! A small hint wouldn't hurt ;)

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

2 participants