Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/TharinduDR/TransQuest.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTharinduDR <rhtdranasinghe@gmail.com>2021-06-03 21:41:18 +0300
committerTharinduDR <rhtdranasinghe@gmail.com>2021-06-03 21:41:18 +0300
commit7a7884d2fca02fedded290a4253627625c1c6653 (patch)
treedf706b8cc2c94672c6a4d4fa5481d1b8272a72f5
parentaf45e485ead27001fa05e7c7312e350412955b9e (diff)
057: Code Refactoring - Siamese Architectures
-rw-r--r--docs/models/sentence_level_pretrained.md28
1 files changed, 27 insertions, 1 deletions
diff --git a/docs/models/sentence_level_pretrained.md b/docs/models/sentence_level_pretrained.md
index ba57f92..d735ab9 100644
--- a/docs/models/sentence_level_pretrained.md
+++ b/docs/models/sentence_level_pretrained.md
@@ -65,4 +65,30 @@ We have released several quality estimation models for this aspect. We have also
| | | | SiameseTransQuest | |
!!! note
- \* denotes any language. (\*-\* means any language to any language) \ No newline at end of file
+ \* denotes any language. (\*-\* means any language to any language)
+
+If you are using the MonoTransQuest architecture, you can use the following code to load the model. The full notebook is available [here.](https://colab.research.google.com/drive/1qsE0e5MDafDeXl8reTwM1dnvy4BKF9Zb?usp=sharing)
+Let's consider loading monotransquest-da-ro_en-wiki.
+
+```python
+import torch
+from transquest.algo.sentence_level.monotransquest.run_model import MonoTransQuestModel
+
+
+model = MonoTransQuestModel("xlmroberta", "TransQuest/monotransquest-da-ro_en-wiki", num_labels=1, use_cuda=torch.cuda.is_available())
+predictions, raw_outputs = model.predict([["Reducerea acestor conflicte este importantă pentru conservare.", "Reducing these conflicts is not important for preservation."]])
+print(predictions)
+```
+
+If you are using the SiameseTransQuest architecture, you can use the following code to load the model. The full notebook is available [here.](https://colab.research.google.com/drive/1EnLTs0691i3b0PELN54riwHRQnGK14B9?usp=sharing)
+Let's consider loading siamesetransquest-da-ro_en-wiki.
+
+```python
+import torch
+from transquest.algo.sentence_level.siamesetransquest.run_model import SiameseTransQuestModel
+
+
+model = SiameseTransQuestModel("TransQuest/siamesetransquest-da-ro_en-wiki")
+predictions = model.predict([["Reducerea acestor conflicte este importantă pentru conservare.", "Reducing these conflicts is not important for preservation."]])
+print(predictions)
+``` \ No newline at end of file