Skip to content

Conversation

@ykhrustalev
Copy link
Contributor

@ykhrustalev ykhrustalev commented Mar 31, 2025

The library has limited support for embedded environments, such as iOS or Mac Catalyst, all due to the huge dependency graph that hf-hub has.

This change makes it possible to strip the hf-hub dependency. The current use for the hf-hub is preserved as a default feature.

Tested to work with:

  • cargo build --release --target aarch64-apple-ios --no-default-features
  • cargo build --release --target aarch64-apple-ios-macabi --no-default-features

The library has limited support for embedded environments, such as
iOS or Mac Catalyst, all due to the huge dependency graph that
hf-hub has.

This change make it possible to strip the hf-hub dependency.
The current use for the hf-hub is preserved as a default feature.

Tested to work with:
* `cargo build --release --target aarch64-apple-ios --no-default-features`
* `cargo build --release --target aarch64-apple-ios-macabi --no-default-features`
@rlouf rlouf requested a review from RobinPicard April 6, 2025 15:44
@ykhrustalev
Copy link
Contributor Author

I will verify ci

@rlouf
Copy link
Member

rlouf commented May 19, 2025

We can merge this temporarily once the tests pass, but a better solution would be to build Vocabulary from a token id -> token map. from_pretrained ends up adding some complexity.

@ykhrustalev
Copy link
Contributor Author

We can merge this temporarily once the tests pass, but a better solution would be to build Vocabulary from a token id -> token map. from_pretrained ends up adding some complexity.

I am actually using this trait

impl TryFrom<(TokenId, HashMap<String, Vec<TokenId>>)> for Vocabulary {
...
     fn try_from(values: (TokenId, HashMap<String, Vec<TokenId>>)) -> Result<Self, Self::Error> {

@ykhrustalev
Copy link
Contributor Author

@rlouf audit fails the same way as on the "main" branch, other CI passes

@rlouf rlouf merged commit ad8c7b7 into dottxt-ai:main May 19, 2025
6 of 7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants