Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Replace usage of Bundle.module to build outside SPM context#125

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
a2they wants to merge1 commit intohuggingface:main
base:main
Choose a base branch
Loading
froma2they:bundle_fix

Conversation

a2they
Copy link

ReplacingBundle.module withBundle(for: self) to accommodate building transformers outside SPM context.

Copy link
Member

@pcuencapcuenca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Very cool, thanks for showing how to do it! 🔥

Apologies for the delay in reviewing, it was a 🦙 week.

I'll check what's happening with the CI.

ZachNagengast and lin72h reacted with rocket emoji
@@ -202,7 +202,8 @@ public class LanguageModelConfigurationFromHub {
}

static func fallbackTokenizerConfig(for modelType: String) -> Config? {
guard let url = Bundle.module.url(forResource: "\(modelType)_tokenizer_config", withExtension: "json") else { return nil }
let bundle = Bundle(for: self)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We could fix the tests doing something like:

Suggested change
letbundle=Bundle(for:self)
letbundle=NSClassFromString("XCTest")!=nil?Bundle.module:Bundle(for:self)

But upon additional testing I found that building a CLI that usesTokenizers would not find the fallback configuration either.

Do you have any thoughts on that? Some additional ideas:

  • Iterate through the bundles and select the right one.
  • Create a bundle (or framework?) solely dedicated to hosting the resources.
  • Download the fallback configs from a well-known location in the Hub.

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

@pcuencapcuencapcuenca approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@a2they@pcuenca

[8]ページ先頭

©2009-2025 Movatter.jp