-
Notifications
You must be signed in to change notification settings - Fork 119
Implemented PEFT feature in CSModel class #28
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
Open
MKHarsha03
wants to merge
19
commits into
vandijklab:master
Choose a base branch
from
MKHarsha03:peft_lora
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
4a7bffe
Peft feature implemented
MKHarsha03 fccd40d
Minor updates
MKHarsha03 7e4a8e1
Removing errors from merge conflicts
MKHarsha03 2d2d598
Cleared merge conflicts in docs/source
MKHarsha03 d8131c3
merge resolved
MKHarsha03 ab78081
merge resolved
MKHarsha03 afdfef7
merge resolved
MKHarsha03 2b02223
merge resolved
MKHarsha03 a37661e
merge resolved
MKHarsha03 19299ff
Added the description for the 10th tutorial in README file
MKHarsha03 e7a2e06
Fixed the tutorial 7 path in readme
MKHarsha03 0c03c1c
removed duplication in readthedocs.yaml file
MKHarsha03 01dcb47
Removed duplication in csmodel.rst
MKHarsha03 0f5bd2e
Removed duplication in csmodel.rst
MKHarsha03 34e5122
changed line 87 in csmodel.py to os.makedirs
MKHarsha03 9216bf8
Created proper test to check if peft layers are loading correctly
MKHarsha03 fc90705
Modified the model loading in fine_tune method under CSModel to load …
MKHarsha03 881dda4
Changed the Trainer argument type back to tokenizer
MKHarsha03 d9d62db
Fixed the broken link for python3.10.20 in README.md
MKHarsha03 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| [](https://www.apache.org/licenses/LICENSE-2.0) | ||
| [](https://badge.fury.io/py/cell2sentence) | ||
| [](https://doi.org/10.1101/2025.04.14.648850) | ||
| [](https://www.python.org/downloads/release/python-380/) | ||
| [](https://www.python.org/downloads/release/python-310020/) | ||
|
||
|
|
||
|  | ||
|
|
||
|
|
@@ -47,7 +47,7 @@ git clone https://github.com/vandijklab/cell2sentence.git | |
|
|
||
| Navigate a terminal into the root of the repository. Next, create an Anaconda environment using `python3` using [anaconda](https://docs.anaconda.com/anaconda/install/) with: | ||
| ```bash | ||
| conda create -n cell2sentence python=3.8 | ||
| conda create -n cell2sentence python=3.10 | ||
| ``` | ||
|
|
||
| Next, activate the environment: | ||
|
|
@@ -62,7 +62,7 @@ make install | |
|
|
||
| This will install the latest development environment of cell2sentence, along with other pacakge dependendies. You can also install cell2sentence itself using `pip`: | ||
| ```bash | ||
| pip install cell2sentence==1.1.0 | ||
| pip install cell2sentence==1.2.0 | ||
| ``` | ||
|
|
||
| The C2S package will allow usage of the core functionalities of C2S, including inference using existing C2S models and finetuning your own C2S models on your own datasets. | ||
|
|
@@ -86,6 +86,10 @@ The following notebooks provide guides on common workflows with C2S models. For | |
| | [c2s_tutorial_4_cell_type_prediction.ipynb](tutorials/c2s_tutorial_4_cell_type_prediction.ipynb) | Cell type prediction using C2S models | ||
| | [c2s_tutorial_5_cell_generation.ipynb](tutorials/c2s_tutorial_5_cell_generation.ipynb) | Cell generation conditioned on cell type | ||
| | [c2s_tutorial_6_cell_annotation_with_foundation_model.ipynb](tutorials/c2s_tutorial_6_cell_annotation_with_foundation_model.ipynb) | Cell type annotation with foundation model | ||
| | [c2s_tutorial_7_custom_prompt_templates.ipynb](tutorials/c2s_tutorials_7_custom_prompt_templates.ipynb) | Custom Prompt Templates with C2S PromptFormatter class | ||
|
||
| | [c2s_tutorial_8_multi_cell_tissue_prediction.ipynb](tutorials/c2s_tutorial_8_multi_cell_tissue_prediction.ipynb) | Classifying the Tissue based on Multiple cell sentences | ||
| | [c2s_tutorial_9_natural_language_interpretation.ipynb](tutorials/c2s_tutorial_9_natural_language_interpretation.ipynb) | Use the C2S model to generate insightful summaries for different sets of cells | ||
| | [c2s_tutorial_10_perturbation_response_prediction.ipynb](tutorials/c2s_tutorial_10_perturbation_response_prediction.ipynb)| | ||
MKHarsha03 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| ## Model Zoo | ||
|
|
@@ -111,7 +115,7 @@ each explain which model they use. | |
| - [x] Add tutorial notebooks for main C2S workflows: cell type prediction, cell generation | ||
| - [x] Add multi-cell prompt formatting | ||
| - [ ] Add support for legacy C2S-GPT-2 model prompts | ||
| - [ ] Add parameter-efficient finetuning methods (LoRA) | ||
| - [x] Add parameter-efficient finetuning methods (LoRA) | ||
|
|
||
|
|
||
| ## License | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,3 +33,4 @@ goto end | |
|
|
||
| :end | ||
| popd | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,26 @@ | ||
|
|
||
| A CSModel object is a wrapper around a Cell2Sentence model, which tracks the path of the model | ||
| saved on disk. When needed, the model is loaded from the path on disk for inference or finetuning. | ||
| The class contains utilities for model generation and cell embedding with a Huggingface backend. | ||
|
|
||
| .. autofunction:: csmodel.CSModel | ||
|
|
||
| .. autofunction:: csmodel.CSModel.__init__ | ||
|
|
||
| .. autofunction:: csmodel.CSModel.__str__ | ||
|
|
||
| .. autofunction:: csmodel.CSModel.fine_tune | ||
|
|
||
| .. autofunction:: csmodel.CSModel.generate_from_prompt | ||
|
|
||
| .. autofunction:: csmodel.CSModel.generate_from_prompt_batched | ||
|
|
||
| .. autofunction:: csmodel.CSModel.embed_cell | ||
|
|
||
| .. autofunction:: csmodel.CSModel.embed_cells_batched | ||
|
|
||
| .. autofunction:: csmodel.CSModel.push_model_to_hub | ||
| ======= | ||
|
||
| CSModel | ||
| ======= | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,44 +1,49 @@ | ||
| [metadata] | ||
| name = cell2sentence | ||
| version = 1.2.0 | ||
| author = Syed Asad Rizvi | ||
| author_email = [email protected] | ||
| description = Cell2Sentence: Single-cell Analysis With LLMs | ||
| long_description = file: README.md | ||
| long_description_content_type = text/markdown | ||
| url = https://github.com/vandijklab/cell2sentence | ||
| license = 'BY-NC-ND' | ||
| project_urls = | ||
| Bug Tracker = https://github.com/vandijklab/cell2sentence/issues | ||
| classifiers = | ||
| Programming Language :: Python :: 3 | ||
| Development Status :: 2 - Pre-Alpha | ||
| Operating System :: OS Independent | ||
|
|
||
| [options] | ||
| package_dir = | ||
| = src | ||
| packages = find: | ||
| python_requires = >=3.7 | ||
| install_requires = | ||
| torch | ||
| transformers | ||
| datasets | ||
| anndata | ||
| scanpy | ||
| numpy | ||
| pandas | ||
| scipy | ||
| tqdm | ||
| scikit-learn | ||
| jupyterlab | ||
| accelerate | ||
| plotnine | ||
| sphinx | ||
| sphinx-rtd-theme | ||
|
|
||
| [options.packages.find] | ||
| where = src | ||
|
|
||
| [options.package_data] | ||
| [metadata] | ||
| name = cell2sentence | ||
| version = 1.2.0 | ||
| author = Syed Asad Rizvi | ||
| author_email = [email protected] | ||
| description = Cell2Sentence: Single-cell Analysis With LLMs | ||
| long_description = file: README.md | ||
| long_description_content_type = text/markdown | ||
| url = https://github.com/vandijklab/cell2sentence | ||
| license = 'BY-NC-ND' | ||
| project_urls = | ||
| Bug Tracker = https://github.com/vandijklab/cell2sentence/issues | ||
| classifiers = | ||
| Programming Language :: Python :: 3 | ||
| Development Status :: 2 - Pre-Alpha | ||
| Operating System :: OS Independent | ||
|
|
||
| [options] | ||
| package_dir = | ||
| = src | ||
| packages = find: | ||
| python_requires = >=3.10 | ||
| install_requires = | ||
| torch | ||
| transformers | ||
| peft | ||
| bitsandbytes | ||
| datasets | ||
| anndata | ||
|
Comment on lines
+23
to
+29
|
||
| scanpy | ||
| numpy | ||
| pandas | ||
| scipy | ||
| tqdm | ||
| scikit-learn | ||
| jupyterlab | ||
| accelerate | ||
| plotnine | ||
| sphinx | ||
| sphinx-rtd-theme | ||
| tiktoken | ||
| sentencepiece | ||
| protobuf | ||
|
|
||
| [options.packages.find] | ||
| where = src | ||
|
|
||
| [options.package_data] | ||
| * = *.json | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.