Instructions to use Mun-Lee/txgemma-2b-pgx-lora-210k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Mun-Lee/txgemma-2b-pgx-lora-210k with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("google/txgemma-2b-predict") model = PeftModel.from_pretrained(base_model, "Mun-Lee/txgemma-2b-pgx-lora-210k") - Notebooks
- Google Colab
- Kaggle
Upload 9 files
Browse files- CHECKSUMS.sha256 +8 -0
- LICENSE +131 -0
- MODIFICATIONS.md +11 -0
- NOTICE +5 -0
- README.md +159 -0
- adapter_config.json +42 -0
- adapter_model.safetensors +3 -0
- examples/synthetic_clinical_examples.jsonl +5 -0
- examples/synthetic_pgx_contexts.jsonl +2 -0
CHECKSUMS.sha256
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
e579385eb0b576c8be53d8d5cbddfcb75de3512e2d771168e28df7d411e28b02 ./LICENSE
|
| 2 |
+
bfc05f146341f4d1906a75d31ed88d88701b635c5087319deaf2df75dce219c2 ./MODIFICATIONS.md
|
| 3 |
+
97460ba7be151965d03efa84c7da6c94a275de421e454283a783f0208ef3b3ed ./NOTICE
|
| 4 |
+
198e670904cfcc1f6e9edc3983d454f566a8859c39b5fd7838b7f57bb4a1fb1d ./README.md
|
| 5 |
+
de1ba0fddb51a81ceb4085821170b8323206e2ed07fcdefe3b299403e0f0b1ca ./adapter_config.json
|
| 6 |
+
396cff95f90c0d338e9e7bb167ac7e709b02dcf0286fa0c99034100a924dab74 ./adapter_model.safetensors
|
| 7 |
+
82479d36e20808694393f6a484621ce4e5ba0c5aeec19e9c89c7cbae5a4ec0da ./examples/synthetic_clinical_examples.jsonl
|
| 8 |
+
ab29104ec64649d308e79ff3bbb4de9ab277f1fc72901213816330b4bd409c24 ./examples/synthetic_pgx_contexts.jsonl
|
LICENSE
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Health AI Developer Foundations Terms of Use
|
| 2 |
+
|
| 3 |
+
Source: https://developers.google.com/health-ai-developer-foundations/terms
|
| 4 |
+
Official page: Google Developers
|
| 5 |
+
Last modified on the official page: November 15, 2024
|
| 6 |
+
|
| 7 |
+
This file reproduces the Health AI Developer Foundations Terms of Use for distribution with this HAI-DEF Model Derivative. The official source above is controlling if Google updates the Agreement after this copy was prepared.
|
| 8 |
+
|
| 9 |
+
By using, reproducing, modifying, distributing, performing, or displaying any portion or element of the HAI-DEF Services (as defined below), or otherwise accepting these Health AI Developer Foundations Terms of Use (the "Agreement"), you agree to be bound by this Agreement.
|
| 10 |
+
|
| 11 |
+
Section 1: DEFINITIONS
|
| 12 |
+
|
| 13 |
+
1.1 Definitions
|
| 14 |
+
|
| 15 |
+
(a) "Clinical Use" means, any use in diagnosis or treatment of patients (including as part of a research study).
|
| 16 |
+
|
| 17 |
+
(b) "Distribution" or "Distribute" means any transmission, publication, or other sharing of HAI-DEF or Model Derivatives to a third party, including by providing or making HAI-DEF or its functionality available as a hosted service via API, web access, or any other electronic or remote means ("Hosted Service").
|
| 18 |
+
|
| 19 |
+
(c) "Google" means Google LLC.
|
| 20 |
+
|
| 21 |
+
(d) "Health AI Developer Foundations" or "HAI-DEF" means the set of machine learning language models, trained model weights, and parameters identified at https://developers.google.com/health-ai-developer-foundations, regardless of the source that you obtained it from.
|
| 22 |
+
|
| 23 |
+
(e) "Health AI Developer Foundations Services" or "HAI-DEF Services" means collectively HAI-DEF or Model Derivatives, including as may be accessed or used via a Hosted Service.
|
| 24 |
+
|
| 25 |
+
(f) "Health Regulatory Authority" means any regulatory authority that oversees health-related products and services, including any national, supra national, regional, state, or local regulatory authority, department, bureau, commission, council, or other authority that is responsible for granting Health Regulatory Authorizations allowing distribution of products, or overseeing the development, use, manufacture, transport, storage, or commercialization of products and services for the diagnosis, cure, prevention, treatment, and/or mitigation of disorders, diseases, or conditions in humans.
|
| 26 |
+
|
| 27 |
+
(g) "Health Regulatory Authorization" means, with respect to any country or jurisdiction, all approvals, registrations, licenses, or authorizations from the relevant Regulatory Authority in a country or jurisdiction for conducting research, Clinical Use, marketing and/or commercializing of a product or service in such country or jurisdiction.
|
| 28 |
+
|
| 29 |
+
(h) "Model Derivatives" means (i) all modifications to HAI-DEF, (ii) all works based on HAI-DEF, or (iii) any other machine learning model which is created by transfer of patterns of the weights, parameters, operations, or Output of HAI-DEF, to that model in order to cause that model to perform similarly to HAI-DEF, including distillation methods that use intermediate data representations or methods based on the generation of synthetic data Outputs by HAI-DEF for training that model.
|
| 30 |
+
|
| 31 |
+
Outputs are not deemed Model Derivatives.
|
| 32 |
+
|
| 33 |
+
(i) "Output" means the information content output of HAI-DEF or a Model Derivative that results from operating or otherwise using HAI-DEF or the Model Derivative, including via a Hosted Service.
|
| 34 |
+
|
| 35 |
+
1.2
|
| 36 |
+
|
| 37 |
+
In this Agreement, "including" means "including but not limited to".
|
| 38 |
+
|
| 39 |
+
Section 2: ELIGIBILITY AND USAGE
|
| 40 |
+
|
| 41 |
+
2.1 Eligibility
|
| 42 |
+
|
| 43 |
+
You represent and warrant that you have the legal capacity to enter into this Agreement (including being of sufficient age of consent).
|
| 44 |
+
|
| 45 |
+
If you are accessing or using any of the HAI-DEF Services for or on behalf of a legal entity, (a) you are entering into this Agreement on behalf of yourself and that legal entity, (b) you represent and warrant that you have the authority to act on behalf of and bind that entity to this Agreement, and (c) references to "you" or "your" in the remainder of this Agreement refers to both you (as an individual) and that entity.
|
| 46 |
+
|
| 47 |
+
2.2 Use
|
| 48 |
+
|
| 49 |
+
You may use, reproduce, modify, Distribute, perform, or display any of the HAI-DEF Services only in accordance with the terms of this Agreement, and must not violate (or encourage or permit anyone else to violate) any term of this Agreement. HAI-DEF’s recipe source code, model inference code, model training code, utility code, and other source code deliverables are licensed under Apache 2.0 available at https://www.apache.org/licenses/LICENSE-2.0.
|
| 50 |
+
|
| 51 |
+
Section 3: DISTRIBUTION AND RESTRICTIONS
|
| 52 |
+
|
| 53 |
+
3.1 Distribution and Redistribution
|
| 54 |
+
|
| 55 |
+
You may reproduce or Distribute copies of HAI-DEF or Model Derivatives if you meet all of the following conditions:
|
| 56 |
+
|
| 57 |
+
1. You must include the use restrictions in Section 3.2 as an enforceable provision in any agreement (e.g., license agreement, terms of use, etc.) governing the use and/or Distribution of HAI-DEF or Model Derivatives and you must notify subsequent users you Distribute to that HAI-DEF or Model Derivatives are subject to the use restrictions in Section 3.2.
|
| 58 |
+
|
| 59 |
+
2. You must provide all third party recipients of HAI-DEF or Model Derivatives a copy of this Agreement.
|
| 60 |
+
|
| 61 |
+
3. You must, when applicable, seek Health Regulatory Authorization from the relevant Health Regulatory Authority.
|
| 62 |
+
|
| 63 |
+
4. You must cause any modified files to carry prominent notices stating that you modified the files.
|
| 64 |
+
|
| 65 |
+
5. All Distributions (other than through a Hosted Service) must be accompanied by a "Notice" text file that contains the following notice: "HAI-DEF is provided under and subject to the Health AI Developer Foundations Terms of Use found at https://developers.google.com/health-ai-developer-foundations/terms".
|
| 66 |
+
|
| 67 |
+
You may add your own intellectual property statement to your modifications and, except as set forth in this Section, may provide additional or different terms and conditions for use, reproduction, or Distribution of your modifications, or for any such Model Derivatives as a whole, provided your use, reproduction, modification, Distribution, performance, and display of HAI-DEF otherwise complies with the terms and conditions of this Agreement.
|
| 68 |
+
|
| 69 |
+
Any additional or different terms and conditions you impose must not conflict with the terms of this Agreement.
|
| 70 |
+
|
| 71 |
+
3.2 Use Restrictions
|
| 72 |
+
|
| 73 |
+
You must not use any of the HAI-DEF Services:
|
| 74 |
+
|
| 75 |
+
1. for the restricted uses described in the Health AI Developer Foundations Prohibited Use Policy at https://developers.google.com/health-ai-developer-foundations/prohibited-use-policy ("Prohibited Use Policy"), which is hereby incorporated by reference into this Agreement;
|
| 76 |
+
|
| 77 |
+
2. for any use that could cause a Health Regulatory Authority to deem Google to be a "manufacturer" of a medical device; or
|
| 78 |
+
|
| 79 |
+
3. in violation of applicable laws and regulations.
|
| 80 |
+
|
| 81 |
+
To the maximum extent permitted by law and without limiting any of Google’s other rights, Google reserves the right to restrict (remotely or otherwise) usage of any of the HAI-DEF Services that Google reasonably believes are in violation of this Agreement.
|
| 82 |
+
|
| 83 |
+
3.3 Generated Output
|
| 84 |
+
|
| 85 |
+
Google will not claim ownership over any original Outputs you generate using HAI-DEF. You acknowledge that Google or HAI-DEF may generate the same or similar Outputs for others, including Google, and that Google reserves all of Google’s rights in the Outputs it generates independently of you. You and your users are solely responsible for Outputs and their subsequent uses.
|
| 86 |
+
|
| 87 |
+
Section 4: ADDITIONAL PROVISIONS
|
| 88 |
+
|
| 89 |
+
4.1 Updates
|
| 90 |
+
|
| 91 |
+
Google may update HAI-DEF from time to time.
|
| 92 |
+
|
| 93 |
+
4.2 Trademarks
|
| 94 |
+
|
| 95 |
+
Nothing in this Agreement grants you any rights to use Google's trademarks, trade names, logos or to otherwise suggest endorsement or misrepresent the relationship between you and Google. Google reserves any rights not expressly granted herein.
|
| 96 |
+
|
| 97 |
+
4.3 DISCLAIMER OF WARRANTY
|
| 98 |
+
|
| 99 |
+
UNLESS REQUIRED BY APPLICABLE LAW, THE HAI-DEF SERVICES AND OUTPUTS ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
| 100 |
+
|
| 101 |
+
YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING, REPRODUCING, MODIFYING, PERFORMING, DISPLAYING, OR DISTRIBUTING ANY OF THE HAI-DEF SERVICES OR OUTPUTS AND ASSUME ANY AND ALL RISKS ASSOCIATED WITH YOUR USE OR DISTRIBUTION OF ANY OF THE HAI-DEF SERVICES OR OUTPUTS AND YOUR EXERCISE OF RIGHTS AND PERMISSIONS UNDER THIS AGREEMENT. YOU AGREE THAT GOOGLE WILL NOT BE DEEMED TO BE FURNISHING ANY MEDICAL ADVICE OR HEALTH CARE SERVICES BY VIRTUE OF PROVIDING THE HAI-DEF SERVICES.
|
| 102 |
+
|
| 103 |
+
4.4 LIMITATION OF LIABILITY
|
| 104 |
+
|
| 105 |
+
TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT AND UNDER NO LEGAL THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY, CONTRACT, OR OTHERWISE, UNLESS REQUIRED BY APPLICABLE LAW, WILL GOOGLE OR ITS AFFILIATES BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, EXEMPLARY, CONSEQUENTIAL, OR PUNITIVE DAMAGES, OR LOST PROFITS OF ANY KIND ARISING FROM THIS AGREEMENT OR RELATED TO ANY OF THE HAI-DEF SERVICES OR OUTPUTS EVEN IF GOOGLE OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
| 106 |
+
|
| 107 |
+
4.5 Indemnification
|
| 108 |
+
|
| 109 |
+
Unless prohibited by applicable law, you will defend and indemnify Google, and its affiliates, directors, officers, employees, and contractors against all liabilities, damages, losses, costs, fees (including legal fees), and expenses relating to any allegations or third-party legal proceeding (including regulatory proceedings) to the extent arising from: (a) your violation of any term of this Agreement; (b) damage or injury to any person or property as a result of your use of HAI-DEF (including your modification, Distribution, reproduction, performance, display, or adaptation of HAI-DEF); (c) your gross negligence or willful misconduct in connection with HAI-DEF; or (d) any claim that any modifications or combinations to HAI-DEF made by you, including Model Derivatives, infringe or violate a third party’s intellectual property or other rights, including applicable privacy or data protection rights.
|
| 110 |
+
|
| 111 |
+
4.6 Term, Termination, and Survival
|
| 112 |
+
|
| 113 |
+
The term of this Agreement will commence upon your acceptance of this Agreement (including acceptance by your use, modification, or Distribution, reproduction, performance, or display of any portion or element of the HAI-DEF Services) and will continue in full force and effect until terminated in accordance with the terms of this Agreement.
|
| 114 |
+
|
| 115 |
+
Google may terminate this Agreement if you are in breach of any term of this Agreement or if Google reasonably determines that a Health Regulatory Authority may deem that Google is, or is reasonably likely to be considered a "manufacturer" of a medical device in connection with your use of the HAI-DEF Services. Upon termination of this Agreement, you must delete and cease use and Distribution of all copies of HAI-DEF and Model Derivatives in your possession or control.
|
| 116 |
+
|
| 117 |
+
Sections 1, 2.1, 3.3, and 4.2 to 4.7 will survive the termination of this Agreement.
|
| 118 |
+
|
| 119 |
+
4.7 General Legal Terms
|
| 120 |
+
|
| 121 |
+
This Agreement states all terms agreed between the parties and supersedes all other agreements between the parties relating to its subject matter. If any provision of this Agreement is held to be invalid, illegal or unenforceable, the rest of the Agreement will remain in effect. Google’s delay or omission in exercising any right under this Agreement will not be treated as a waiver of that right.
|
| 122 |
+
|
| 123 |
+
CALIFORNIA LAW WILL GOVERN ALL DISPUTES ARISING OUT OF OR RELATING TO THIS AGREEMENT AND THE HAI-DEF SERVICES, REGARDLESS OF ANY CONFLICT OF LAWS RULES. THESE DISPUTES WILL BE RESOLVED EXCLUSIVELY IN THE FEDERAL OR STATE COURTS OF SANTA CLARA COUNTY, CALIFORNIA, USA, AND THE PARTIES CONSENT TO PERSONAL JURISDICTION IN THOSE COURTS.
|
| 124 |
+
|
| 125 |
+
---
|
| 126 |
+
|
| 127 |
+
Attribution for this reproduced copy:
|
| 128 |
+
Google Developers — “Health AI Developer Foundations Terms of Use”
|
| 129 |
+
https://developers.google.com/health-ai-developer-foundations/terms
|
| 130 |
+
The official page states that, except as otherwise noted, page content is licensed under the Creative Commons Attribution 4.0 License.
|
| 131 |
+
https://creativecommons.org/licenses/by/4.0/
|
MODIFICATIONS.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Modification notice
|
| 2 |
+
|
| 3 |
+
This repository contains a study-specific LoRA adapter derived from `google/txgemma-2b-predict`.
|
| 4 |
+
|
| 5 |
+
- The upstream Google base-model weights are **not** included.
|
| 6 |
+
- The distributed `adapter_model.safetensors` contains LoRA parameters produced by study-specific fine-tuning.
|
| 7 |
+
- The distributed `adapter_config.json` records the adapter configuration, including LoRA rank `r = 8` and LoRA alpha `8`.
|
| 8 |
+
- The released artifact corresponds to the selected **210,000-step checkpoint** used for PGx representation extraction in the associated manuscript.
|
| 9 |
+
- The files under `examples/` are synthetic/illustrative release materials and are not real patient records.
|
| 10 |
+
|
| 11 |
+
Use and redistribution are subject to the Health AI Developer Foundations Terms of Use referenced in `README.md` and `NOTICE`.
|
NOTICE
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
HAI-DEF is provided under and subject to the Health AI Developer Foundations Terms of Use found at https://developers.google.com/health-ai-developer-foundations/terms
|
| 2 |
+
|
| 3 |
+
Base model: google/txgemma-2b-predict
|
| 4 |
+
|
| 5 |
+
This repository distributes a manuscript-specific LoRA adapter derived from the base model identified above. The adapter was produced by study-specific LoRA fine-tuning and selected from the 210,000-step checkpoint. Google base-model weights are not redistributed in this repository.
|
README.md
CHANGED
|
@@ -1,5 +1,164 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
license: other
|
| 3 |
license_name: health-ai-developer-foundations
|
| 4 |
license_link: https://developers.google.com/health-ai-developer-foundations/terms
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model: google/txgemma-2b-predict
|
| 3 |
+
library_name: peft
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
license: other
|
| 6 |
license_name: health-ai-developer-foundations
|
| 7 |
license_link: https://developers.google.com/health-ai-developer-foundations/terms
|
| 8 |
+
language:
|
| 9 |
+
- en
|
| 10 |
+
tags:
|
| 11 |
+
- lora
|
| 12 |
+
- peft
|
| 13 |
+
- txgemma
|
| 14 |
+
- pharmacogenomics
|
| 15 |
+
- lung-cancer
|
| 16 |
+
- reproducibility
|
| 17 |
---
|
| 18 |
+
|
| 19 |
+
# TxGemma PGx LoRA Adapter — 210k Checkpoint
|
| 20 |
+
|
| 21 |
+
This repository provides the manuscript-specific LoRA adapter used for the pharmacogenomic (PGx) representation component of the study **“Leveraging Pharmacogenomic Signals to Augment Genomic–Treatment Representations for Prognostic Prediction of 1-Year Mortality in Lung Cancer.”**
|
| 22 |
+
|
| 23 |
+
The released adapter corresponds to the selected **210,000-step checkpoint** used for PGx representation extraction. This repository distributes the adapter only; it does **not** redistribute Google TxGemma base-model weights.
|
| 24 |
+
|
| 25 |
+
## Model artifact
|
| 26 |
+
|
| 27 |
+
- **Base model:** `google/txgemma-2b-predict`
|
| 28 |
+
- **Adapter framework:** LoRA / PEFT
|
| 29 |
+
- **Selected checkpoint:** 210,000 steps
|
| 30 |
+
- **LoRA rank (`r`):** 8
|
| 31 |
+
- **LoRA alpha:** 8
|
| 32 |
+
- **LoRA dropout:** 0.0
|
| 33 |
+
- **Bias:** none
|
| 34 |
+
- **Target modules:** `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj`
|
| 35 |
+
- **Task type:** causal language modeling
|
| 36 |
+
|
| 37 |
+
The repository root contains:
|
| 38 |
+
|
| 39 |
+
- `adapter_config.json`
|
| 40 |
+
- `adapter_model.safetensors`
|
| 41 |
+
- `LICENSE`
|
| 42 |
+
- `NOTICE`
|
| 43 |
+
- `MODIFICATIONS.md`
|
| 44 |
+
- `CHECKSUMS.sha256`
|
| 45 |
+
- `examples/synthetic_clinical_examples.jsonl`
|
| 46 |
+
- `examples/synthetic_pgx_contexts.jsonl`
|
| 47 |
+
|
| 48 |
+
## Base-model access and adapter loading
|
| 49 |
+
|
| 50 |
+
The adapter requires separate access to `google/txgemma-2b-predict`. Access to the base model is governed by Google's Health AI Developer Foundations (HAI-DEF) Terms of Use and may require acceptance of those terms on Hugging Face.
|
| 51 |
+
|
| 52 |
+
A minimal PEFT loading pattern is:
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 56 |
+
from peft import PeftModel
|
| 57 |
+
|
| 58 |
+
base_model_id = "google/txgemma-2b-predict"
|
| 59 |
+
adapter_path = "." # repository root after cloning/downloading
|
| 60 |
+
|
| 61 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
|
| 62 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 63 |
+
base_model_id,
|
| 64 |
+
device_map="auto",
|
| 65 |
+
torch_dtype="auto",
|
| 66 |
+
)
|
| 67 |
+
model = PeftModel.from_pretrained(base_model, adapter_path)
|
| 68 |
+
model.eval()
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
The code above demonstrates adapter loading only. It is not intended to reproduce the protected clinical cohort or the complete downstream survival-prediction analysis.
|
| 72 |
+
|
| 73 |
+
## Synthetic clinical examples
|
| 74 |
+
|
| 75 |
+
The `examples/` directory contains a small set of **fully synthetic, fictional clinical examples** created solely to illustrate the expected structure of study inputs.
|
| 76 |
+
|
| 77 |
+
- `examples/synthetic_clinical_examples.jsonl` contains **five** fictional patient-level examples.
|
| 78 |
+
- `examples/synthetic_pgx_contexts.jsonl` contains **two** illustrative PGx inference-context examples derived from those fictional records.
|
| 79 |
+
|
| 80 |
+
These examples:
|
| 81 |
+
|
| 82 |
+
- were created from scratch;
|
| 83 |
+
- do **not** contain real patient records;
|
| 84 |
+
- are **not** perturbations or transformations of real patient records;
|
| 85 |
+
- are **not** intended to reproduce the study cohort distribution; and
|
| 86 |
+
- are **not** intended to reproduce the reported model-performance estimates.
|
| 87 |
+
|
| 88 |
+
No outcome labels are included in the synthetic clinical examples. The study target was **1-year all-cause mortality from the predefined landmark**.
|
| 89 |
+
|
| 90 |
+
## PGx inference-context examples
|
| 91 |
+
|
| 92 |
+
The illustrative PGx context records demonstrate, at a structural level, how a medication-specific molecular representation and altered-gene context can be represented together for encoder input. They are provided for transparency only and are **not asserted to reproduce an exact production prompt string or a real patient record**.
|
| 93 |
+
|
| 94 |
+
These examples are distinct from the GDSC fine-tuning prompt format described in the Supplementary Methods.
|
| 95 |
+
|
| 96 |
+
## Representation lineage
|
| 97 |
+
|
| 98 |
+
At a high level, the study pipeline can be summarized as:
|
| 99 |
+
|
| 100 |
+
```text
|
| 101 |
+
Protected clinical / genomic source data
|
| 102 |
+
↓
|
| 103 |
+
Integrated patient-level clinical information
|
| 104 |
+
↓
|
| 105 |
+
┌──────────────────┬──────────────────────┬────────────────────────┐
|
| 106 |
+
│ ENF representation│ PGx inference context│ CTE / E2E / GKC │
|
| 107 |
+
│ │ │ baseline representations│
|
| 108 |
+
└──────────────────┴──────────────────────┴────────────────────────┘
|
| 109 |
+
↓
|
| 110 |
+
Model-ready representations
|
| 111 |
+
↓
|
| 112 |
+
EHR + PGx late fusion
|
| 113 |
+
↓
|
| 114 |
+
XGBoost
|
| 115 |
+
↓
|
| 116 |
+
1-year mortality prediction
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
The patient-level PGx representation described in the manuscript is obtained by aggregating context-level encoder representations. Protected patient-level clinical data and patient-level PGx feature vectors are not included in this public repository.
|
| 120 |
+
|
| 121 |
+
## Scope and reproducibility boundary
|
| 122 |
+
|
| 123 |
+
This repository is intended to support **model accessibility, methodological specification, and privacy-preserving transparency** for the study.
|
| 124 |
+
|
| 125 |
+
Included:
|
| 126 |
+
|
| 127 |
+
- the manuscript-specific LoRA adapter;
|
| 128 |
+
- the exact PEFT adapter configuration distributed with that adapter;
|
| 129 |
+
- synthetic patient-level input examples; and
|
| 130 |
+
- illustrative PGx inference-context examples.
|
| 131 |
+
|
| 132 |
+
Not included:
|
| 133 |
+
|
| 134 |
+
- protected patient-level EHR or genomic data;
|
| 135 |
+
- real patient identifiers or outcome labels;
|
| 136 |
+
- pre-calculated real-patient PGx feature vectors;
|
| 137 |
+
- downstream patient-level prediction files; or
|
| 138 |
+
- downstream classifier weights fitted to the protected clinical cohort.
|
| 139 |
+
|
| 140 |
+
Accordingly, the public materials support inspection and reuse of the PGx adapter and the input structure without releasing protected clinical data. They do not by themselves reproduce the manuscript's patient-level performance estimates.
|
| 141 |
+
|
| 142 |
+
## Modification notice
|
| 143 |
+
|
| 144 |
+
This repository contains a manuscript-specific LoRA model derivative of `google/txgemma-2b-predict`. The adapter weights were produced by study-specific LoRA fine-tuning, and the selected released artifact corresponds to the 210,000-step checkpoint. No Google base-model weights are redistributed here. See `MODIFICATIONS.md` for a concise artifact-level notice.
|
| 145 |
+
|
| 146 |
+
## License and use restrictions
|
| 147 |
+
|
| 148 |
+
This adapter is a model derivative of TxGemma and is distributed subject to the **Health AI Developer Foundations Terms of Use**:
|
| 149 |
+
|
| 150 |
+
https://developers.google.com/health-ai-developer-foundations/terms
|
| 151 |
+
|
| 152 |
+
The HAI-DEF Prohibited Use Policy incorporated by those terms is available at:
|
| 153 |
+
|
| 154 |
+
https://developers.google.com/health-ai-developer-foundations/prohibited-use-policy
|
| 155 |
+
|
| 156 |
+
A local copy of the HAI-DEF Terms of Use is included in `LICENSE`. Users are responsible for complying with those terms, including applicable use and redistribution restrictions. Access to and use of the separate TxGemma base model are also subject to the base model's applicable terms. The required HAI-DEF distribution notice is included in `NOTICE`.
|
| 157 |
+
|
| 158 |
+
Google does not endorse this repository or the associated study. `TxGemma`, `Gemma`, and `Google` are referenced only to identify the upstream model and provider.
|
| 159 |
+
|
| 160 |
+
## Associated manuscript
|
| 161 |
+
|
| 162 |
+
**Leveraging Pharmacogenomic Signals to Augment Genomic–Treatment Representations for Prognostic Prediction of 1-Year Mortality in Lung Cancer**
|
| 163 |
+
|
| 164 |
+
PLOS Digital Health — major revision materials.
|
adapter_config.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha_pattern": {},
|
| 3 |
+
"auto_mapping": null,
|
| 4 |
+
"base_model_name_or_path": "google/txgemma-2b-predict",
|
| 5 |
+
"bias": "none",
|
| 6 |
+
"corda_config": null,
|
| 7 |
+
"eva_config": null,
|
| 8 |
+
"exclude_modules": null,
|
| 9 |
+
"fan_in_fan_out": false,
|
| 10 |
+
"inference_mode": true,
|
| 11 |
+
"init_lora_weights": true,
|
| 12 |
+
"layer_replication": null,
|
| 13 |
+
"layers_pattern": null,
|
| 14 |
+
"layers_to_transform": null,
|
| 15 |
+
"loftq_config": {},
|
| 16 |
+
"lora_alpha": 8,
|
| 17 |
+
"lora_bias": false,
|
| 18 |
+
"lora_dropout": 0.0,
|
| 19 |
+
"megatron_config": null,
|
| 20 |
+
"megatron_core": "megatron.core",
|
| 21 |
+
"modules_to_save": null,
|
| 22 |
+
"peft_type": "LORA",
|
| 23 |
+
"qalora_group_size": 16,
|
| 24 |
+
"r": 8,
|
| 25 |
+
"rank_pattern": {},
|
| 26 |
+
"revision": null,
|
| 27 |
+
"target_modules": [
|
| 28 |
+
"o_proj",
|
| 29 |
+
"v_proj",
|
| 30 |
+
"k_proj",
|
| 31 |
+
"gate_proj",
|
| 32 |
+
"up_proj",
|
| 33 |
+
"down_proj",
|
| 34 |
+
"q_proj"
|
| 35 |
+
],
|
| 36 |
+
"target_parameters": null,
|
| 37 |
+
"task_type": "CAUSAL_LM",
|
| 38 |
+
"trainable_token_indices": null,
|
| 39 |
+
"use_dora": false,
|
| 40 |
+
"use_qalora": false,
|
| 41 |
+
"use_rslora": false
|
| 42 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:396cff95f90c0d338e9e7bb167ac7e709b02dcf0286fa0c99034100a924dab74
|
| 3 |
+
size 20814808
|
examples/synthetic_clinical_examples.jsonl
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"synthetic_patient_id": "SYN001", "age_years": 47, "sex": "Female", "metastatic_disease_at_landmark": false, "landmark_days_after_diagnosis": 90, "genes": ["KRAS", "RB1"], "drug_classes": ["Targeted_KRAS", "Immuno_PD1_PDL1"], "drugs": ["Adagrasib", "Pembrolizumab"], "labs": {"ALBUMIN": [4.1, 4.0, 3.9, 4.0, 3.8], "BASOPHILS": [0.02, 0.03, 0.02, 0.04, 0.03], "CALCIUM": [9.4, 9.2, 9.3, 9.1, 9.0], "EOSINOPHILS": [0.08, 0.1, 0.12, 0.09, 0.11], "HEMOGLOBIN": [12.8, 12.5, 12.3, 12.1, 11.9], "LEUKOCYTES": [6.8, 7.1, 6.6, 7.4, 7.0], "LYMPHOCYTES": [24.0, 22.5, 23.1, 21.8, 22.2], "MONOCYTES": [0.52, 0.58, 0.55, 0.61, 0.57], "NEUTROPHIL": [4.2, 4.5, 4.0, 4.8, 4.4], "PLATELETS": [278.0, 265.0, 289.0, 271.0, 260.0]}}
|
| 2 |
+
{"synthetic_patient_id": "SYN002", "age_years": 58, "sex": "Male", "metastatic_disease_at_landmark": true, "landmark_days_after_diagnosis": 90, "genes": ["EPHA3", "EZH2", "BRIP1"], "drug_classes": ["Immuno_PD1_PDL1", "Targeted_Anti_Angiogenic"], "drugs": ["Atezolizumab", "Bevacizumab"], "labs": {"ALBUMIN": [3.3, 3.4, 3.2, 3.5, 3.4], "BASOPHILS": [0.05, 0.04, 0.06, 0.04, 0.05], "CALCIUM": [8.7, 8.8, 8.6, 8.9, 8.8], "EOSINOPHILS": [0.18, 0.15, 0.19, 0.16, 0.17], "HEMOGLOBIN": [10.4, 10.1, 10.6, 10.3, 10.0], "LEUKOCYTES": [8.6, 8.1, 8.9, 8.3, 8.0], "LYMPHOCYTES": [15.2, 16.0, 14.7, 15.5, 16.3], "MONOCYTES": [0.81, 0.76, 0.84, 0.79, 0.74], "NEUTROPHIL": [6.7, 6.2, 6.9, 6.4, 6.0], "PLATELETS": [338.0, 321.0, 346.0, 329.0, 315.0]}}
|
| 3 |
+
{"synthetic_patient_id": "SYN003", "age_years": 69, "sex": "Female", "metastatic_disease_at_landmark": false, "landmark_days_after_diagnosis": 90, "genes": ["MAP2K2 (MEK2)", "VHL"], "drug_classes": ["Targeted_BRAF_MEK"], "drugs": ["Trametinib"], "labs": {"ALBUMIN": [3.8, 3.7, 3.9, 3.8, 3.6], "BASOPHILS": [0.01, 0.02, 0.01, 0.03, 0.02], "CALCIUM": [9.8, 9.5, 9.6, 9.4, 9.7], "EOSINOPHILS": [0.06, 0.07, 0.05, 0.08, 0.06], "HEMOGLOBIN": [13.4, 13.0, 12.9, 13.1, 12.7], "LEUKOCYTES": [5.9, 6.2, 5.7, 6.0, 5.8], "LYMPHOCYTES": [30.5, 28.9, 31.2, 29.7, 30.1], "MONOCYTES": [0.44, 0.49, 0.46, 0.51, 0.47], "NEUTROPHIL": [3.4, 3.7, 3.2, 3.5, 3.3], "PLATELETS": [196.0, 208.0, 201.0, 214.0, 205.0]}}
|
| 4 |
+
{"synthetic_patient_id": "SYN004", "age_years": 73, "sex": "Male", "metastatic_disease_at_landmark": true, "landmark_days_after_diagnosis": 90, "genes": ["CD274 (PD-L1)", "NFKBIA", "CBL"], "drug_classes": ["Immuno_PD1_PDL1"], "drugs": ["Pembrolizumab"], "labs": {"ALBUMIN": [2.9, 3.0, 2.8, 3.1, 3.0], "BASOPHILS": [0.07, 0.05, 0.06, 0.08, 0.05], "CALCIUM": [8.2, 8.4, 8.3, 8.1, 8.5], "EOSINOPHILS": [0.24, 0.2, 0.22, 0.19, 0.21], "HEMOGLOBIN": [9.1, 9.4, 9.0, 9.6, 9.3], "LEUKOCYTES": [11.6, 10.8, 11.2, 10.4, 10.9], "LYMPHOCYTES": [11.0, 12.4, 10.8, 13.1, 12.0], "MONOCYTES": [1.12, 1.04, 1.18, 0.98, 1.09], "NEUTROPHIL": [9.0, 8.3, 8.7, 7.9, 8.4], "PLATELETS": [402.0, 388.0, 415.0, 376.0, 394.0]}}
|
| 5 |
+
{"synthetic_patient_id": "SYN005", "age_years": 62, "sex": "Female", "metastatic_disease_at_landmark": false, "landmark_days_after_diagnosis": 90, "genes": ["PIK3CG", "DAXX", "SPEN"], "drug_classes": ["Immuno_CTLA4", "Immuno_PD1_PDL1"], "drugs": ["Tremelimumab", "Atezolizumab"], "labs": {"ALBUMIN": [3.6, 3.5, 3.7, 3.4, 3.6], "BASOPHILS": [0.03, 0.04, 0.03, 0.02, 0.04], "CALCIUM": [9.0, 9.1, 8.9, 9.2, 9.0], "EOSINOPHILS": [0.13, 0.14, 0.12, 0.15, 0.11], "HEMOGLOBIN": [11.6, 11.3, 11.8, 11.4, 11.2], "LEUKOCYTES": [7.4, 7.8, 7.1, 7.6, 7.3], "LYMPHOCYTES": [19.4, 18.7, 20.1, 19.0, 20.6], "MONOCYTES": [0.67, 0.71, 0.65, 0.73, 0.69], "NEUTROPHIL": [5.2, 5.5, 4.9, 5.3, 5.0], "PLATELETS": [244.0, 251.0, 238.0, 257.0, 247.0]}}
|
examples/synthetic_pgx_contexts.jsonl
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"synthetic_patient_id": "SYN001", "selected_drug": "Adagrasib", "hallmark_genes": ["KRAS", "RB1"], "smiles": "CN1CCC[C@H]1COC2=NC3=C(CCN(C3)C4=CC=CC5=C4C(=CC=C5)Cl)C(=N2)N6CCN([C@H](C6)CC#N)C(=O)C(=C)F", "inference_context": "### Input:\nSMILES: CN1CCC[C@H]1COC2=NC3=C(CCN(C3)C4=CC=CC5=C4C(=CC=C5)Cl)C(=N2)N6CCN([C@H](C6)CC#N)C(=O)C(=C)F\nHallmark Genes: KRAS, RB1\n\n", "illustrative_only": true, "patient_derived": false}
|
| 2 |
+
{"synthetic_patient_id": "SYN003", "selected_drug": "Trametinib", "hallmark_genes": ["MAP2K2 (MEK2)", "VHL"], "smiles": "CC1=C2C(=C(N(C1=O)C)NC3=C(C=C(C=C3)I)F)C(=O)N(C(=O)N2C4=CC=CC(=C4)NC(=O)C)C5CC5", "inference_context": "### Input:\nSMILES: CC1=C2C(=C(N(C1=O)C)NC3=C(C=C(C=C3)I)F)C(=O)N(C(=O)N2C4=CC=CC(=C4)NC(=O)C)C5CC5\nHallmark Genes: MAP2K2 (MEK2), VHL\n\n", "illustrative_only": true, "patient_derived": false}
|