camel-ai / camel

🐫 CAMEL: Finding the Scaling Law of Agents. A multi-agent framework. https://www.camel-ai.org
https://docs.camel-ai.org/
Apache License 2.0
5.49k stars 674 forks source link

[Feature Request] Discussion on the implementation of open source model type #407

Open ocss884 opened 10 months ago

ocss884 commented 10 months ago

Required prerequisites

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

dandansamax commented 10 months ago

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?