Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dian xt ms #29

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bug fix
  • Loading branch information
AmiyaSX committed May 30, 2023
commit bfe0c11aa2dfaf93696d020d1c3cd86489c4020e
6 changes: 3 additions & 3 deletions xt/model/muzero/muzero_model_ms.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from collections import OrderedDict
from typing import List
from mindspore import nn, ops, ParameterTuple
from xt.model.ms_compat import ms, Tensor, Adam, Cell, TrainOneStepCellFixedLossScaleUpdateCell
from xt.model.ms_compat import ms, Tensor, Adam, Cell, TrainOneStepCell, FixedLossScaleUpdateCell
from xt.model.model_ms import XTModel_MS, check_keep_model
from xt.model.muzero.default_config import LR, td_step
from xt.model.muzero.muzero_utils_ms import value_compression_ms,\
Expand Down Expand Up @@ -265,7 +265,7 @@ def value_inference(self, input_data):

class myTrainOneStepCell(TrainOneStepCell):
def __init__(self, network, optimizer):
super(MyTrainOneStepCell, self).__init__(network, optimizer)
super(myTrainOneStepCell, self).__init__(network, optimizer)
self.depend = ops.Depend()
self.network = network
self.grad_fn = ops.value_and_grad(
Expand Down Expand Up @@ -367,4 +367,4 @@ def dnet(self):
return self.dynamic_network
@property
def pnet(self):
return self.policy_network
return self.policy_network
3 changes: 2 additions & 1 deletion xt/model/ppo/ppo_ms.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
from zeus.common.util.common import import_config
from zeus.common.util.register import Registers
from xt.model.ms_compat import Cell, TrainOneStepCell, LossBase, ReduceMean, ReduceSum, Tensor, Adam
from xt.model.ms_compat import Depend, value_and_grad, clip_by_global_norm, Minimum, Maximum, Exp, Square, clip_by_value, DynamicLossScaleUpdateCell,FixedLossScaleUpdateCell
from xt.model.ms_compat import Depend, value_and_grad, clip_by_global_norm, Minimum, Maximum, Exp, Square, clip_by_value, DynamicLossScaleUpdateCell, FixedLossScaleUpdateCell
from xt.model.model_ms import XTModel_MS
from xt.model.ms_utils import MSVariables
import mindspore as ms
from xt.model.dqn.dqn_cnn_ms import MyTrainOneStepCell

ms.set_context(runtime_num_threads=30)
@Registers.model
class PPOMS(XTModel_MS):

Expand Down