Skip to content

Passing Tokenizer to LanguageModel #238

@yiyinglai

Description

@yiyinglai

Hello, I would like to use swift-transformers in my iOS application to simply development and avoid accessing network if possible.

I have downloaded a LLM model in coreML format and created LanguageModel with the loaded native coreML model. However, then I called generate on LanguageModel, it started to download something from the web and failed. I assume it is trying to download tokenizer, right?

Task <1F0DB5AB-3745-463B-AC02-D6D34023259A>.<1> finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2102, NSUnderlyingError=0x3000c4570 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <1F0DB5AB-3745-463B-AC02-D6D34023259A>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <1F0DB5AB-3745-463B-AC02-D6D34023259A>.<1>"
), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=https://huggingface.co/api/models/DeepSeek-R1-Distill-Qwen-1.5B-4bit/revision/main, NSErrorFailingURLKey=https://huggingface.co/api/models/DeepSeek-R1-Distill-Qwen-1.5B-4bit/revision/main, _kCFStreamErrorDomainKey=4}

I created AutoTokenizer from local tokenizer folder URL (under which tokenizer_config.json and tokenizer.json are available) successfully. Can I pass the created AutoTokenizer to LanguageModel?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions