lm-sys / lm-sys/FastChat

Duplicate GeminiAdapter class definition found

Open
#3,462 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
39.5k
Forks
4.8k
PR merge metrics
No merged PRs in 30d

Description

I've noticed that there are two identical class definitions for `GeminiAdapter` in the same file. This appears to be an unintended duplication.

- File: `fastchat/model/model_adapter.py`
- Lines: 1202-1212 and 2193-2205
```python
# fastchat/model/model_adapter.py

# line 1202
class GeminiAdapter(BaseModelAdapter):
"""The model adapter for Gemini"""

def match(self, model_path: str):
return "gemini" in model_path.lower() or "bard" in model_path.lower()

def load_model(self, model_path: str, from_pretrained_kwargs: dict):
raise NotImplementedError()

def get_default_conv_template(self, model_path: str) -> Conversation:
return get_conv_template("gemini")

# line 2193
class GeminiAdapter(BaseModelAdapter):
"""The model adapter for Gemini"""

def match(self, model_path: str):
return "gemini" in model_path.lower() or "bard" in model_path.lower()

def load_model(self, model_path: str, from_pretrained_kwargs: dict):
raise NotImplementedError()

def get_default_conv_template(self, model_path: str) -> Conversation:
if "gemini-1.5-pro" in model_path:
return get_conv_template("gemini-1.5-pro")
return get_conv_template("gemini")

```
The classes are identical except for the `get_default_conv_template` method. The second definition includes an additional check for "gemini-1.5-pro".

Suggestion:
Consider merging these two class definitions, keeping the more specific `get_default_conv_template` method from the second definition. This would avoid confusion and potential issues with class resolution.

Please let me know if you need any further information or clarification.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open fastchat/model/model_adapter.py and inspect both GeminiAdapter definitions at lines 1202-1212 and 2193-2205. Compare their behavior and retain one definition with the gemini-1.5-pro handling described in the issue. Done means the duplicate definition is removed without losing either adapter behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.