Skip to content

Falled to load Qwen3 model locally #305

Open
@Linorman

Description

@Linorman

This the function that gives error: MLXLMCommon.ModelFactoryError error 0.
I call this function with type: 'qwen3'

func loadModelContext(modelConfiguration: ModelConfiguration, type: String) async throws -> ModelContext {
        let configurationURL = modelConfiguration.modelDirectory().appendingPathComponent("config.json")
        let baseConfig = try JSONDecoder().decode(BaseConfiguration.self, from: Data(contentsOf: configurationURL))
        let model = try LLMModelFactory.shared.typeRegistry.createModel(configuration: configurationURL, modelType: type)
        try loadWeights(modelDirectory: modelConfiguration.modelDirectory(), model: model, quantization: baseConfig.quantization)
        let tokenizer = try await loadTokenizer(configuration: modelConfiguration, hub: HubApi(downloadBase: modelConfiguration.modelDirectory()))
        let processor = LLMUserInputProcessor(tokenizer: tokenizer, configuration: modelConfiguration)
        return ModelContext(configuration: modelConfiguration, model: model, processor: processor, tokenizer: tokenizer)
    }

When I use Qwen2 model and change type to "qwen2", everything works well, so I can't figure out what's going on, and I am sure I use the latest version of mlx-examples (main branch).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions