Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
acb2b77
1
Parent(s):
77c5b54
more tweaks
Browse files- app.py +16 -29
- hf_calculator.py +0 -1
- simulation_scripts.py +0 -1
app.py
CHANGED
|
@@ -44,7 +44,6 @@ DEFAULT_MOLECULAR_SETTINGS = {
|
|
| 44 |
|
| 45 |
|
| 46 |
def main():
|
| 47 |
-
|
| 48 |
input_structure = gr.File(
|
| 49 |
label="ASE-compatible structure",
|
| 50 |
file_types=[".cif", ".pdb", ".xyz", ".traj", "INCAR", "POSCAR"],
|
|
@@ -126,19 +125,20 @@ def main():
|
|
| 126 |
with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
| 127 |
with gr.Row():
|
| 128 |
with gr.Column(scale=2):
|
| 129 |
-
|
| 130 |
with gr.Column(variant="panel"):
|
| 131 |
-
gr.Markdown(
|
| 132 |
-
"# Meta's Universal Model for Atoms (UMA) Demo"
|
| 133 |
-
)
|
| 134 |
-
|
| 135 |
-
|
| 136 |
|
| 137 |
with gr.Tab("1. UMA Intro"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
-
gr.
|
| 140 |
-
|
| 141 |
-
|
| 142 |
with gr.Row():
|
| 143 |
gr.Examples(
|
| 144 |
examples=[
|
|
@@ -203,10 +203,6 @@ def main():
|
|
| 203 |
|
| 204 |
gr.Markdown(
|
| 205 |
"""
|
| 206 |
-
In this demo:
|
| 207 |
-
* Every example is a specific molecular structure or material that can be simulated using the UMA model.
|
| 208 |
-
* Each simulation you see would take days or weeks using a traditional quantum chemistry simulation, but UMA can do it in seconds or minutes!
|
| 209 |
-
* Examples in the demo are cached ahead of time so they should load right away, but if you run a custom simulation you'll see a progress bar while the simulation runs.
|
| 210 |
|
| 211 |
When you've run your first UMA simulation, click on the next tab above to explore the UMA model in more detail and see how it works across many different domains/examples!
|
| 212 |
"""
|
|
@@ -577,12 +573,8 @@ def main():
|
|
| 577 |
)
|
| 578 |
|
| 579 |
with gr.Sidebar(open=True):
|
| 580 |
-
gr.Markdown(
|
| 581 |
-
|
| 582 |
-
)
|
| 583 |
-
with gr.Accordion(
|
| 584 |
-
"What is UMA?", open=False
|
| 585 |
-
):
|
| 586 |
gr.Markdown(
|
| 587 |
"""
|
| 588 |
* UMA models predict motion and behavior at the atomic scale, ultimately reducing the development cycle in molecular and materials discovery and unlocking new possibilities for innovation and impact.
|
|
@@ -592,9 +584,7 @@ def main():
|
|
| 592 |
Read the UMA paper for details or download the UMA model and FAIR Chemistry repository to use this yourself!
|
| 593 |
"""
|
| 594 |
)
|
| 595 |
-
with gr.Accordion(
|
| 596 |
-
"Should I trust UMA?", open=False
|
| 597 |
-
):
|
| 598 |
gr.Markdown(
|
| 599 |
"""
|
| 600 |
* The UMA model paper contains rigorous accuracy benchmarks on a number of validation sets across chemistry and materials science. As of model release the UMA model was at or near the state-of-the-art for generalization machine learning potentials. Read the UMA paper for details.
|
|
@@ -609,9 +599,7 @@ def main():
|
|
| 609 |
* Meta's Fundamental AI Research Lab (FAIR) is drastically accelerating this process by developing accurate and generalizable machine learning models, building on work by academic, industrial, and national lab collaborators.
|
| 610 |
"""
|
| 611 |
)
|
| 612 |
-
with gr.Accordion(
|
| 613 |
-
"Open source packages in this demo", open=False
|
| 614 |
-
):
|
| 615 |
gr.Markdown(
|
| 616 |
"""
|
| 617 |
* The model code is available on github at [FAIR chemistry repo](https://github.com/facebookresearch/fairchem)
|
|
@@ -623,7 +611,8 @@ def main():
|
|
| 623 |
"""
|
| 624 |
* Each simulation you see would take days or weeks using a traditional quantum chemistry simulation, but UMA can do it in seconds or minutes!
|
| 625 |
* Examples in the demo are cached ahead of time so they should load right away, but if you run a custom simulation you'll see a progress bar while the simulation runs.'
|
| 626 |
-
"""
|
|
|
|
| 627 |
|
| 628 |
gr.Markdown("## Simulation inputs")
|
| 629 |
|
|
@@ -631,7 +620,6 @@ def main():
|
|
| 631 |
gr.Markdown("### 1. Example structure (or upload your own!)")
|
| 632 |
with gr.Row():
|
| 633 |
with gr.Column():
|
| 634 |
-
|
| 635 |
input_structure.render()
|
| 636 |
|
| 637 |
gr.LoginButton(size="large")
|
|
@@ -853,7 +841,6 @@ def main():
|
|
| 853 |
|
| 854 |
|
| 855 |
if __name__ == "__main__":
|
| 856 |
-
|
| 857 |
# On load, build and install the gradio_molecul3d fork
|
| 858 |
subprocess.call(
|
| 859 |
["gradio", "cc", "install"], cwd=Path(__file__).parent / "gradio_molecule3d/"
|
|
|
|
| 44 |
|
| 45 |
|
| 46 |
def main():
|
|
|
|
| 47 |
input_structure = gr.File(
|
| 48 |
label="ASE-compatible structure",
|
| 49 |
file_types=[".cif", ".pdb", ".xyz", ".traj", "INCAR", "POSCAR"],
|
|
|
|
| 125 |
with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
| 126 |
with gr.Row():
|
| 127 |
with gr.Column(scale=2):
|
|
|
|
| 128 |
with gr.Column(variant="panel"):
|
| 129 |
+
gr.Markdown("# Meta's Universal Model for Atoms (UMA) Demo")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
with gr.Tab("1. UMA Intro"):
|
| 132 |
+
gr.Image(
|
| 133 |
+
"figures/uma_overview_figure.svg",
|
| 134 |
+
label="UMA Overview",
|
| 135 |
+
show_share_button=False,
|
| 136 |
+
show_download_button=False,
|
| 137 |
+
)
|
| 138 |
|
| 139 |
+
gr.Markdown(
|
| 140 |
+
"This is UMA! It is a large mixture-of-linear-experts graph network model trained on billions of atoms across five open-science simulation datasets released by the FAIR Chemistry team over the past 5 years. If you give it an input structure and which task you're interested in modeling in, it will output the energy, forces, and stress which you can use for a molecular simulation! Try one of these examples to see what it can do."
|
| 141 |
+
)
|
| 142 |
with gr.Row():
|
| 143 |
gr.Examples(
|
| 144 |
examples=[
|
|
|
|
| 203 |
|
| 204 |
gr.Markdown(
|
| 205 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
|
| 207 |
When you've run your first UMA simulation, click on the next tab above to explore the UMA model in more detail and see how it works across many different domains/examples!
|
| 208 |
"""
|
|
|
|
| 573 |
)
|
| 574 |
|
| 575 |
with gr.Sidebar(open=True):
|
| 576 |
+
gr.Markdown("## Learn more about UMA")
|
| 577 |
+
with gr.Accordion("What is UMA?", open=False):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 578 |
gr.Markdown(
|
| 579 |
"""
|
| 580 |
* UMA models predict motion and behavior at the atomic scale, ultimately reducing the development cycle in molecular and materials discovery and unlocking new possibilities for innovation and impact.
|
|
|
|
| 584 |
Read the UMA paper for details or download the UMA model and FAIR Chemistry repository to use this yourself!
|
| 585 |
"""
|
| 586 |
)
|
| 587 |
+
with gr.Accordion("Should I trust UMA?", open=False):
|
|
|
|
|
|
|
| 588 |
gr.Markdown(
|
| 589 |
"""
|
| 590 |
* The UMA model paper contains rigorous accuracy benchmarks on a number of validation sets across chemistry and materials science. As of model release the UMA model was at or near the state-of-the-art for generalization machine learning potentials. Read the UMA paper for details.
|
|
|
|
| 599 |
* Meta's Fundamental AI Research Lab (FAIR) is drastically accelerating this process by developing accurate and generalizable machine learning models, building on work by academic, industrial, and national lab collaborators.
|
| 600 |
"""
|
| 601 |
)
|
| 602 |
+
with gr.Accordion("Open source packages in this demo", open=False):
|
|
|
|
|
|
|
| 603 |
gr.Markdown(
|
| 604 |
"""
|
| 605 |
* The model code is available on github at [FAIR chemistry repo](https://github.com/facebookresearch/fairchem)
|
|
|
|
| 611 |
"""
|
| 612 |
* Each simulation you see would take days or weeks using a traditional quantum chemistry simulation, but UMA can do it in seconds or minutes!
|
| 613 |
* Examples in the demo are cached ahead of time so they should load right away, but if you run a custom simulation you'll see a progress bar while the simulation runs.'
|
| 614 |
+
"""
|
| 615 |
+
)
|
| 616 |
|
| 617 |
gr.Markdown("## Simulation inputs")
|
| 618 |
|
|
|
|
| 620 |
gr.Markdown("### 1. Example structure (or upload your own!)")
|
| 621 |
with gr.Row():
|
| 622 |
with gr.Column():
|
|
|
|
| 623 |
input_structure.render()
|
| 624 |
|
| 625 |
gr.LoginButton(size="large")
|
|
|
|
| 841 |
|
| 842 |
|
| 843 |
if __name__ == "__main__":
|
|
|
|
| 844 |
# On load, build and install the gradio_molecul3d fork
|
| 845 |
subprocess.call(
|
| 846 |
["gradio", "cc", "install"], cwd=Path(__file__).parent / "gradio_molecule3d/"
|
hf_calculator.py
CHANGED
|
@@ -30,7 +30,6 @@ def hash_save_file(atoms: ase.Atoms, task_name, path: Path | str):
|
|
| 30 |
|
| 31 |
|
| 32 |
class HFEndpointCalculator(Calculator):
|
| 33 |
-
|
| 34 |
# A simple calculator that uses the Hugging Face Inference Endpoints to run
|
| 35 |
|
| 36 |
implemented_properties = ["energy", "free_energy", "stress", "forces"]
|
|
|
|
| 30 |
|
| 31 |
|
| 32 |
class HFEndpointCalculator(Calculator):
|
|
|
|
| 33 |
# A simple calculator that uses the Hugging Face Inference Endpoints to run
|
| 34 |
|
| 35 |
implemented_properties = ["energy", "free_energy", "stress", "forces"]
|
simulation_scripts.py
CHANGED
|
@@ -96,7 +96,6 @@ def run_md_simulation(
|
|
| 96 |
spin_multiplicity = 0
|
| 97 |
|
| 98 |
try:
|
| 99 |
-
|
| 100 |
atoms = load_check_ase_atoms(structure_file)
|
| 101 |
|
| 102 |
# Check if the file is an example
|
|
|
|
| 96 |
spin_multiplicity = 0
|
| 97 |
|
| 98 |
try:
|
|
|
|
| 99 |
atoms = load_check_ase_atoms(structure_file)
|
| 100 |
|
| 101 |
# Check if the file is an example
|