Update README.md
Browse files
README.md
CHANGED
|
@@ -8,6 +8,44 @@ We hope it can be used:
|
|
| 8 |
- Word Embedding Model for Chinese Medicine Domain Data
|
| 9 |
- Support for a wide range of downstream TCM tasks, e.g., classification tasks, labeling tasks, etc.
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
### requirements
|
| 12 |
```bash
|
| 13 |
pip install herberta
|
|
@@ -16,12 +54,13 @@ pip install herberta
|
|
| 16 |
```python
|
| 17 |
from herberta.embedding import TextToEmbedding
|
| 18 |
|
| 19 |
-
|
| 20 |
embedder = TextToEmbedding("path/to/your/model")
|
| 21 |
|
| 22 |
# Single text input
|
| 23 |
embedding = embedder.get_embeddings("This is a sample text.")
|
| 24 |
|
|
|
|
| 25 |
# Multiple text input
|
| 26 |
texts = ["This is a sample text.", "Another example."]
|
| 27 |
embeddings = embedder.get_embeddings(texts)
|
|
|
|
| 8 |
- Word Embedding Model for Chinese Medicine Domain Data
|
| 9 |
- Support for a wide range of downstream TCM tasks, e.g., classification tasks, labeling tasks, etc.
|
| 10 |
|
| 11 |
+
### model_config
|
| 12 |
+
```json
|
| 13 |
+
{
|
| 14 |
+
"_name_or_path": "./herberta",
|
| 15 |
+
"architectures": [
|
| 16 |
+
"BertForMaskedLM"
|
| 17 |
+
],
|
| 18 |
+
"attention_probs_dropout_prob": 0.1,
|
| 19 |
+
"bos_token_id": 0,
|
| 20 |
+
"classifier_dropout": null,
|
| 21 |
+
"directionality": "bidi",
|
| 22 |
+
"eos_token_id": 2,
|
| 23 |
+
"hidden_act": "gelu",
|
| 24 |
+
"hidden_dropout_prob": 0.1,
|
| 25 |
+
"hidden_size": 1024,
|
| 26 |
+
"initializer_range": 0.02,
|
| 27 |
+
"intermediate_size": 4096,
|
| 28 |
+
"layer_norm_eps": 1e-12,
|
| 29 |
+
"max_position_embeddings": 512,
|
| 30 |
+
"model_type": "bert",
|
| 31 |
+
"num_attention_heads": 16,
|
| 32 |
+
"num_hidden_layers": 24,
|
| 33 |
+
"output_past": true,
|
| 34 |
+
"pad_token_id": 0,
|
| 35 |
+
"pooler_fc_size": 768,
|
| 36 |
+
"pooler_num_attention_heads": 12,
|
| 37 |
+
"pooler_num_fc_layers": 3,
|
| 38 |
+
"pooler_size_per_head": 128,
|
| 39 |
+
"pooler_type": "first_token_transform",
|
| 40 |
+
"position_embedding_type": "absolute",
|
| 41 |
+
"torch_dtype": "float32",
|
| 42 |
+
"transformers_version": "4.45.1",
|
| 43 |
+
"type_vocab_size": 2,
|
| 44 |
+
"use_cache": true,
|
| 45 |
+
"vocab_size": 21128
|
| 46 |
+
}
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
### requirements
|
| 50 |
```bash
|
| 51 |
pip install herberta
|
|
|
|
| 54 |
```python
|
| 55 |
from herberta.embedding import TextToEmbedding
|
| 56 |
|
| 57 |
+
|
| 58 |
embedder = TextToEmbedding("path/to/your/model")
|
| 59 |
|
| 60 |
# Single text input
|
| 61 |
embedding = embedder.get_embeddings("This is a sample text.")
|
| 62 |
|
| 63 |
+
|
| 64 |
# Multiple text input
|
| 65 |
texts = ["This is a sample text.", "Another example."]
|
| 66 |
embeddings = embedder.get_embeddings(texts)
|