camel
camel copied to clipboard
[Feature Request] Discussion on the implementation of open source model type
Required prerequisites
- [X] I have searched the Issue Tracker and Discussions that this hasn't already been reported. (+1 or comment there if it has.)
- [X] Consider asking first in a Discussion.
Motivation
As we're going to support more models, I'd like to discuss the further implementation of ModelType
here.
In the current version, specific models are attributes of enum class ModelType
. It is not a problem for closed-source models. For open source models, like LLama2, instead of using the whole model name, users need to use ModelType.LLAMA_2
and then choose the model path that specifies which llama-2 model they are going to use. For example:
https://github.com/camel-ai/camel/blob/98c1fbe90af343ad074bc6ee79b00f582ab3abbf/examples/open_source_models/role_playing_with_open_source_model.py#L94-L98
Considering open-source models are usually available on huggingface model hub and the convenience for the community, how about aligning our api design for open-source models to huggingface style and hiding the manual path selection to users as it can be handled by hf functions.
Solution
For each specific model, create the corresponding huggingface model value in the enum class. e.g.
class ModelType(Enum)
...
LLAMA_2_7b__chat_hf = "meta-llama/Llama-2-7b-chat-hf"
...
In addition, we can also support hf style string of model names at the same time, as many other projects just keep using it (like vllm, OpenLLM). e.g.
some_model_config(model_type="meta-llama/Llama-2-7b-chat-hf", ...)
Alternatives
No response
Additional context
No response
I think it is a very good solution. Just a little bit uncomfortable to use ModelType.value
to represent "model name" for OpenAI models, while using it to represent "model path" for hugging faces model. Do you think we can add an attribute or something?