Skip to content

Conversation

fredsamhaak
Copy link
Contributor

Dear authors of omicverse,

First of all, thanks for providing such a useful tool!
I've added a function to annotate cell types using local LLMs (e.g. Qwen/Qwen2-7B-Instruct). This might be a useful feature for those who has local computing resources.

Feel free to contact me if you have any questions.

All the best,
He

@Starlitnightly
Copy link
Owner

Hi, Can you provide a full tutorial? In markdown format.

Best Regards.
Zehua

@fredsamhaak
Copy link
Contributor Author

fredsamhaak commented Jun 27, 2024

Hi @Starlitnightly, here is the tutorial. It is quite simple so I just put it directly below:

=====
Before starting with the cell type annotation, ensure you have preprocessed your data accordingly. The data preprocessing steps should provide you with a dictionary or a pandas DataFrame containing clusters and their respective gene markers.

To use ov.single.gptcelltype_local function to annotate cell types, you can simply set the model_name parameter:

# Example dictionary of gene markers for clusters
all_markers={
    'cluster1':['CD3D','CD3E'],
    'cluster2':['MS4A1']
}

model_name = 'path/to/your/local/model'  # e.g. '~/models/Qwen2-7B-Instruct'

# Annotate cell types
result = gptcelltype_local(all_markers, tissuename='PBMC', speciename='human', 
                           model_name=model_name, topgenenumber=5)
result

Note that you may encounter network problems that prevent you from downloading the model. In this case, please refer to https://zhuanlan.zhihu.com/p/663712983.

=====

Please feel free to contact me if you have other questions.

All the best,
He

@Starlitnightly
Copy link
Owner

I understand what you're saying, but is it possible for the model to be recognised for weights straight after it's been downloaded? Doesn't it require any other additional configuration?

Also, for local models, ollama is a good choice and compatible with our api.

Zehua

@fredsamhaak
Copy link
Contributor Author

Yes, the model can be recognized for weights immediately after download without needing additional configuration. Here is an example:

image

Thanks for reminding me of ollama and I will keep an eye on it.

All the best,
He

@Starlitnightly Starlitnightly merged commit e46ba99 into Starlitnightly:master Jun 28, 2024
@Starlitnightly
Copy link
Owner

Yes, the model can be recognized for weights immediately after download without needing additional configuration. Here is an example:

image Thanks for reminding me of `ollama` and I will keep an eye on it.

All the best, He

Our tutorial is at https://github.com/Starlitnightly/omicverse/blob/master/omicverse_guide/docs/Tutorials-single/t_gptanno.ipynb. You can add a section on local LLM using at the end of the tutorial.

Zehua

Starlitnightly added a commit that referenced this pull request Jun 30, 2024
Add a function of cell types annotation with local LLMs
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.

2 participants