mnnllm 0.0.2 copy "mnnllm: ^0.0.2" to clipboard
mnnllm: ^0.0.2 copied to clipboard

PlatformAndroid

A Flutter Plugin binding for MNN-LLM, enable LLM inference on mobile phones.

mnnllm (MNN-LLM Flutter Plugin) #

pub package

LOGO

A Flutter Plugin for Android and IOS based on MNN-LLM.

Android iOS
Support SDK 26+ Not Supported

Getting Started #

Add mnnllm as a dependency in your pubspec.yaml file.

dependencies:
  mnnllm: ^{{latest version}}

Replace {{latest version}} with the version number in badge above.

Runtime Screenshot #

The example app running on Kirin 960 The example app running on Exynos 880

Usage #

  1. Import Package.
import 'package:mnnllm/mnnllm.dart';
  1. Download Model.
await _mnnllmPlugin.downloadWithListen(modelID, listen: (state) {
      setState(() {
        downloadingState = state;
      });
    });
  1. Initialize Model.
int? val = await _mnnllmPlugin.initModel(
        modelID,
        _mnnllmPlugin.getModelName(modelID),
        configPath,
        _mnnllmPlugin.getSessionId(null),
        keepHistory: false
    );
  1. Generate Tokens.
_mnnllmPlugin.generateStreamAnswer(inputText,
            (data) { setState(() { generateText = data.toString(); }); },
            (err) { print(err.toString()); });

Warnings #

  • The development for the iOS platform is still proceeding in pace.

RoadMap #

  • Support for iOS platform
  • Support for text-to-image generation models
  • Support for multimodal large models

Contact Me #

Liu liuzhi1999@foxmail.com

1
likes
140
points
5
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter Plugin binding for MNN-LLM, enable LLM inference on mobile phones.

Homepage
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on mnnllm

Packages that implement mnnllm