Skip to content

Conversation

@gsy19971111
Copy link
Contributor

PR types

PR changes

Describe

@paddle-bot
Copy link

paddle-bot bot commented Sep 30, 2025

Thanks for your contribution!

@CLAassistant
Copy link

CLAassistant commented Sep 30, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@wangguan1995 wangguan1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tofix

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多余文件需要清理一下

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要按照代码规范进行修改:

  1. 整理相关requirements
  2. 修改ipynb为py文件,进行代码的整理
  3. 使用pre-commit进行代码清理
  4. 补充文档,暂时放在当前文件夹
image

https://paddlescience-docs.readthedocs.io/zh-cn/latest/zh/development/#4

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件还麻烦放到examples/下面,然后使用这种方法注册到ppsci.data里,可以给XXXConstraint初始化时使用

## examples/era5_land_dataset.py‎

from ppsci.data import register_to_dataset

class ToyTwoModalDataset(Dataset):
    pass


register_to_dataset(ToyTwoModalDataset) # here

Copy link
Contributor

@wangguan1995 wangguan1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to fix

import paddle.nn as nn


# =========================
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释清理



class NLinear(nn.Layer):
"""PackedEnsemble: K 份 Linear 打包 → 输入 (B,K,D), 权重 (K, I, O)"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

中文->英文注释

):
super().__init__()
self.k, self.in_f, self.out_f = k, in_f, out_f
self.weight = self.create_parameter(shape=[in_f, out_f]) # 共享权重
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

中文注释

if self.min_adapter is not None:
x = self.min_adapter(x)
feats = self.backbone(x) # (B,K,H)
return feats.mean(axis=1) if self.reduce else feats # (B,H) 或 (B,K,H)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

return losses


# ------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此处注释删掉

return y.squeeze(1), aux


# ====================== Self-Attention Transformer(可 MoE) ======================
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

return x, aux_total


# ====================== AFNO(1D) + MoE FFN ======================
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

class AFNO1DLayer(nn.Layer):
"""
自适应傅里叶算子(时间 1D 版):
- 对 (B,T,D) 沿 T 做 rFFT → (B,D,F)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

def __getitem__(self, idx: int):
###返回三个字典
return {"video": self.video[idx], "vec": self.vec[idx]}, {"y": self.y[idx]}, {}
# return self.video[idx], self.vec[idx], self.y[idx]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删除无用注释

def __len__(self):
return self.n

###在这个基础上加constraint,构建已有约束,Loss Focal BCE,valid_dataloader_cfg,加input和label
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

Copy link
Contributor

@wangguan1995 wangguan1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to fix

self, output_dict, label_dict, weight_dict=None
) -> Dict[str, "paddle.Tensor"]:
losses: Dict[str, paddle.Tensor] = {}
# print(label_dict)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

清理一下print

# final global/per-key weighting like in L2Loss

losses[key] = loss
print(losses)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

清理一下print

@gsy19971111 gsy19971111 reopened this Oct 30, 2025
@gsy19971111 gsy19971111 reopened this Oct 30, 2025
@plusNew001 plusNew001 closed this Oct 30, 2025
@plusNew001 plusNew001 reopened this Oct 30, 2025
@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Oct 30, 2025
@PaddlePaddle PaddlePaddle unlocked this conversation Oct 30, 2025
Copy link

@mattheliu mattheliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

尽快用pre-commit过一下代码规范CI

@HydrogenSulfate HydrogenSulfate merged commit c284bec into PaddlePaddle:develop Oct 31, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants