Sifal commited on
Commit
dd40d9d
·
verified ·
1 Parent(s): fd870aa

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -0
README.md CHANGED
@@ -75,6 +75,31 @@ Clinical Mosaic was pre-trained on deidentified clinical notes from MIMIC-IV-NOT
75
 
76
  Install the Hugging Face Transformers library and load the model as follows:
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  ```python
79
  from transformers import AutoModelForSequenceClassification, BertTokenizer, BertConfig
80
 
 
75
 
76
  Install the Hugging Face Transformers library and load the model as follows:
77
 
78
+ ### For embeddings generation:
79
+
80
+ ```python
81
+ from transformers import AutoModel, BertTokenizer, BertConfig
82
+
83
+ tokenizer = BertTokenizer.from_pretrained('bert-base-uncased') # MosaicBERT uses the standard BERT tokenizer
84
+ config = BertConfig.from_pretrained('Sifal/ClinicalMosaic') # the config needs to be passed in
85
+
86
+ ClincalMosaic = AutoModel.from_pretrained(
87
+ 'Sifal/ClinicalMosaic',
88
+ config=config,
89
+ torch_dtype='auto',
90
+ trust_remote_code=True,
91
+ device_map="auto"
92
+ )
93
+
94
+ # Example usage
95
+ clinical_text = "..."
96
+
97
+ inputs = tokenizer(clinical_text, return_tensors="pt")
98
+ last_layer_embeddings = ClincalMosaic(**inputs, output_all_encoded_layers=False)
99
+ ```
100
+
101
+ ### For sequence classification:
102
+
103
  ```python
104
  from transformers import AutoModelForSequenceClassification, BertTokenizer, BertConfig
105