Skip to content

Commit

Permalink
Make global executable.
Browse files Browse the repository at this point in the history
  • Loading branch information
knc6 committed Sep 22, 2024
1 parent 3cd5ec5 commit d573d62
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ pip install atomgpt
Forwards model are used for developing surrogate models for atomic structure to property predictions. It requires text input which can be either the raw POSCAR type files or a text description of the material. After that, we can use Google-T5/ OpenAI GPT2 etc. models with customizing langauage head for accomplishing such a task. The description of a material is generated with [ChemNLP/describer](https://github.com/usnistgov/jarvis/blob/master/jarvis/core/atoms.py#L1567) function. If you turn [`convert`](https://github.com/usnistgov/atomgpt/blob/develop/atomgpt/forward_models/forward_models.py#L277) to `False`, you can also train on bare POSCAR files.

```
python atomgpt/forward_models/forward_models.py --config_name atomgpt/examples/forward_model/config.json
atomgpt_forward --config_name atomgpt/examples/forward_model/config.json
```

## Inverse model example (property to structure)

Inverse models are used for generating materials given property and description such as chemical formula. Currently, we use Mistral model, but other models such as Gemma, Lllama etc. can also be easily used. After the structure generation, we can optimize the structure with ALIGNN-FF model (example [here](https://colab.research.google.com/github/knc6/jarvis-tools-notebooks/blob/master/jarvis-tools-notebooks/ALIGNN_Structure_Relaxation_Phonons_Interface.ipynb) and then subject to density functional theory calculations for a few selected candidates using JARVIS-DFT or similar workflow (tutorial for example [here](https://pages.nist.gov/jarvis/tutorials/). Note that currently, the inversely model training as well as conference requires GPUs.

```
python atomgpt/inverse_models/inverse_models.py --config_name atomgpt/examples/inverse_model/config.json
atomgpt_inverse --config_name atomgpt/examples/inverse_model/config.json
```

More detailed examples/case-studies would be added here soon.
Expand Down
2 changes: 1 addition & 1 deletion atomgpt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Version number."""

__version__ = "2024.9.8"
__version__ = "2024.9.18"
6 changes: 4 additions & 2 deletions atomgpt/inverse_models/inverse_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TrainingPropConfig(BaseSettings):
prefix: str = "atomgpt_run"
model_name: str = "unsloth/mistral-7b-bnb-4bit"
batch_size: int = 2
num_epochs: int = 2
num_epochs: int = 5
seed_val: int = 42
num_train: Optional[int] = 2
num_val: Optional[int] = 2
Expand Down Expand Up @@ -179,7 +179,9 @@ def gen_atoms(prompt="", max_new_tokens=512, model="", tokenizer=""):
outputs = model.generate(
**inputs, max_new_tokens=max_new_tokens, use_cache=True
)
response = tokenizer.batch_decode(outputs)[0].split("# Output:")[1]
response = tokenizer.batch_decode(outputs)
print("response", response)
response = response[0].split("# Output:")[1]
atoms = None
try:
atoms = text2atoms(response)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="atomgpt",
version="2024.9.8",
version="2024.9.18",
author="Kamal Choudhary",
author_email="[email protected]",
description="atomgpt",
Expand Down

0 comments on commit d573d62

Please sign in to comment.