8000 top_k deepseek cot support by StanChan03 · Pull Request #171 · lotus-data/lotus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

top_k deepseek cot support #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 21, 2025
Merged

top_k deepseek cot support #171

merged 3 commits into from
Apr 21, 2025

Conversation

StanChan03
Copy link
Collaborator
@StanChan03 StanChan03 commented Apr 14, 2025

Introduces DeepSeek CoT for Sem_topk operator.

Function call:

sorted_df, stats = df.sem_topk(
        "{Review} suggests that the user would recommend the product to others",
        K=2,
        method=method,
        strategy=ReasoningStrategy.ZS_COT,
        return_stats=True,
        return_explanations=True,

Example Output:

                                              Review                                        explanation
0  This vacuum cleaner is the best I've ever owne...  Alright, so I need to figure out which documen...
1  Amazing build quality and customer support. Wo...  Okay, let's tackle this question step by step....
{'total_tokens': 1053, 'total_llm_calls': 5, 'explanations': {}}

@@ -37,54 +41,75 @@ def get_match_prompt_binary(
content_text, content_image_inputs = task_instructions.context_formatter(doc)
prompt += [{"type": "text", "text": f"\nDocument {idx+1}:\n{content_text}"}, *content_image_inputs]

if strategy == ReasoningStrategy.ZS_COT and model.get_model_name().startswith("deepseek-r1"):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have a function in the model class or util that returns whether the model is deepseek or not? IMO it is more comprehensive in case some other vendor is used for Deepseek

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean like instead of the get_model_name function in the LM class?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to remove get_model_name. For now, we can have is_deepseek function in the LM class.
Later on, if we have more such cases, we can have an Enum for ModelType and a function/property to return ModelType for an instance of the LM class. @liana313 what are your thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, we should avoid hardcoding "deepseek-r1" anywhere in the code. .get_model_name().is_deepseek() is okay for now

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, okay I can get that done

@StanChan03 StanChan03 merged commit 901f5bb into main Apr 21, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0