mlc-llm icon indicating copy to clipboard operation
mlc-llm copied to clipboard

Phi 3 128

Open sebastienbo opened this issue 2 months ago • 11 comments

🚀 Feature

Introduce phi 3 mini 128k instruct

https://huggingface.co/microsoft/Phi-3-mini-128k-instruct

Mini can run on phones (there is a 4k version and 128k version)

Motivation

Alternatives

Additional context

sebastienbo avatar Apr 23 '24 16:04 sebastienbo

r u run phi3 ok?

moondiy avatar Apr 25 '24 06:04 moondiy

r u run phi3 ok?

What do you mean?

sebastienbo avatar Apr 25 '24 08:04 sebastienbo

The 128k version could allow us to analyze a pdf from the phone. the 4k version would probably be less cpu intensive and would work out of the box.

sebastienbo avatar Apr 25 '24 12:04 sebastienbo

sorry.i want to known that are yiu run phi3 mini model on the phone?i i run it with onnxruntime genai but it's too slow

moondiy avatar Apr 26 '24 01:04 moondiy

Well I use phi2 all the time using ml. Android on my phone with Snapdragon 2nd gen and it works really good and smooth. That is why I would like to know how I can put phi 3 on mlc.

sebastienbo avatar Apr 26 '24 21:04 sebastienbo

Have you tried following the instructions for building new models?

kripper avatar May 01 '24 01:05 kripper

Tried following the instructions, and got the error:

ValueError: Unknown model type: phi3. Available ones: ['llama', 'mistral', 'gemma', 'gpt2', 'mixtral', 'gpt_neox', 'gpt_bigcode', 'phi-msft', 'phi', 'qwen', 'qwen2', 'stablelm', 'baichuan', 'internlm', 'rwkv5', 'orion', 'llava', 'rwkv6', 'chatglm', 'eagle']

indiejoseph avatar May 01 '24 10:05 indiejoseph

I would try to add the string "phi3" to the list

kripper avatar May 01 '24 11:05 kripper

@kripper thanks for your advice, the MODELS is not really just a list with a model name, it is a dict with the model name as key and the corresponding loader and implementation.

I've tried specify the --model-type phi-msft but without luck.

indiejoseph avatar May 01 '24 12:05 indiejoseph

I would first research if the model loader is compatible with previous versions. If so, map the ID to the existing loader. Otherwise, create a new loader and have fun hacking, ie:

  • research what changed by comparing (diff) the official loader for the previous and new versions.
  • replicate those changes in mlc-llm's loader

Always prefere to share a same code base for the old and new model and use conditions (if(version == 1) {...} else if(version == 3) {...}).

kripper avatar May 01 '24 12:05 kripper

Once this is figured out please update the android app apk with phi3. ❤️

unmotivatedgene avatar May 01 '24 13:05 unmotivatedgene