Translation
Transformers
PyTorch
t5
text2text-generation
chemistry
biology
text-generation-inference
Instructions to use AI4PD/REXzyme with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AI4PD/REXzyme with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="AI4PD/REXzyme")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("AI4PD/REXzyme") model = AutoModelForSeq2SeqLM.from_pretrained("AI4PD/REXzyme") - Notebooks
- Google Colab
- Kaggle
Commit ·
1bd5ce8
1
Parent(s): f92eef9
changed small thing in code snippet for reaction smile conversion
Browse filessplit/seperated reaction components by . to avoid complication with positvely charged ions (e.g. H+)
README.md
CHANGED
|
@@ -44,9 +44,9 @@ e.g. for the carbonic anhydrase reaction: ```r2sO.COO>>HCOOO.[H+]</s>```
|
|
| 44 |
or via this simple python script:
|
| 45 |
|
| 46 |
```python
|
| 47 |
-
# left reactants (seperated by
|
| 48 |
-
reactions = "CO2
|
| 49 |
-
# agents (seperated by
|
| 50 |
agent = ""
|
| 51 |
|
| 52 |
# https://stackoverflow.com/questions/54930121/converting-molecule-name-to-smiles
|
|
@@ -61,9 +61,9 @@ def CIRconvert(ids):
|
|
| 61 |
except:
|
| 62 |
return 'Did not work'
|
| 63 |
|
| 64 |
-
reagent = [CIRconvert(i) for i in reactions.replace(' ','').split('=')[0].split('
|
| 65 |
-
agent = [CIRconvert(i) for i in agent.replace(' ','').split('
|
| 66 |
-
product = [CIRconvert(i) for i in reactions.replace(' ','').split('=')[1].split('
|
| 67 |
f"r2s{'.'.join(reagent)}>{'.'.join(agent)}>{'.'.join(product)}</s>"
|
| 68 |
```
|
| 69 |
|
|
|
|
| 44 |
or via this simple python script:
|
| 45 |
|
| 46 |
```python
|
| 47 |
+
# left reactants (seperated by .) seperated by a equal sign from the products (seperated by .)
|
| 48 |
+
reactions = "CO2 . H2O = carbonic acid . H+"
|
| 49 |
+
# agents (seperated by .)
|
| 50 |
agent = ""
|
| 51 |
|
| 52 |
# https://stackoverflow.com/questions/54930121/converting-molecule-name-to-smiles
|
|
|
|
| 61 |
except:
|
| 62 |
return 'Did not work'
|
| 63 |
|
| 64 |
+
reagent = [CIRconvert(i) for i in reactions.replace(' ','').split('=')[0].split('.') if i != ""]
|
| 65 |
+
agent = [CIRconvert(i) for i in agent.replace(' ','').split('.') if i != ""]
|
| 66 |
+
product = [CIRconvert(i) for i in reactions.replace(' ','').split('=')[1].split('.') if i != ""]
|
| 67 |
f"r2s{'.'.join(reagent)}>{'.'.join(agent)}>{'.'.join(product)}</s>"
|
| 68 |
```
|
| 69 |
|