From e47999726d950c4e0ae68fc7ed9859646de7b886 Mon Sep 17 00:00:00 2001 From: wangqc <1160619743@qq.com> Date: Thu, 12 Jun 2025 14:09:54 +0800 Subject: [PATCH 1/2] feat: add the link of ckpt in test --- .../applications/crystalflow/test_crystalflow.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/MindChemistry/applications/crystalflow/test_crystalflow.py b/MindChemistry/applications/crystalflow/test_crystalflow.py index ffce4881f..38a58657d 100644 --- a/MindChemistry/applications/crystalflow/test_crystalflow.py +++ b/MindChemistry/applications/crystalflow/test_crystalflow.py @@ -7,6 +7,7 @@ import mindspore.numpy as mnp from mindspore import nn, ops, Tensor, mint, load_checkpoint, load_param_into_net from mindchemistry.graph.loss import L2LossMask import numpy as np +import urllib.request from models.cspnet import CSPNet @@ -33,6 +34,13 @@ class SinusoidalTimeEmbeddings(nn.Cell): (ops.Sin()(embeddings), ops.Cos()(embeddings))) return embeddings +def download_file(url, filename): + try: + urllib.request.urlretrieve(url, filename) + print(f"File downloaded successfully: {filename}") + except Exception as e: + print(f"Failed to download file: {e}") + def test_cspnet(): """test cspnet.py""" ms.set_seed(1234) @@ -153,7 +161,8 @@ def test_loss(): cspnet = CSPNet(num_layers=6, hidden_dim=512, num_freqs=256) cspflow = CSPFlow(cspnet) - mindspore_ckpt = load_checkpoint("./torch2ms_ckpt/ms_flow.ckpt") + download_file('https://download-mindspore.osinfra.cn/mindscience/mindchemistry/crystalflow/ms_flow.ckpt', 'ms_flow.ckpt') + mindspore_ckpt = load_checkpoint("ms_flow.ckpt") load_param_into_net(cspflow, mindspore_ckpt) loss_func_mse = L2LossMask(reduction='mean') @@ -189,3 +198,4 @@ def test_loss(): break assert mseloss_l <= 0.7, "The denoising of lattice accuracy is not successful." assert mseloss_x <= 0.7, "The denoising of fractional coordinates accuracy is not successful." +test_loss() \ No newline at end of file -- Gitee From 2966f3cc70e15531c76be12a635931b45d6c72a9 Mon Sep 17 00:00:00 2001 From: wangqc <1160619743@qq.com> Date: Thu, 12 Jun 2025 14:26:55 +0800 Subject: [PATCH 2/2] feat: add the link of ckpt in test --- MindChemistry/applications/crystalflow/test_crystalflow.py | 1 - 1 file changed, 1 deletion(-) diff --git a/MindChemistry/applications/crystalflow/test_crystalflow.py b/MindChemistry/applications/crystalflow/test_crystalflow.py index 38a58657d..18e0a9199 100644 --- a/MindChemistry/applications/crystalflow/test_crystalflow.py +++ b/MindChemistry/applications/crystalflow/test_crystalflow.py @@ -198,4 +198,3 @@ def test_loss(): break assert mseloss_l <= 0.7, "The denoising of lattice accuracy is not successful." assert mseloss_x <= 0.7, "The denoising of fractional coordinates accuracy is not successful." -test_loss() \ No newline at end of file -- Gitee