Commit fa086873 authored by Cihad's avatar Cihad
Browse files

Integrated EMADL2CPP generator with SchemaLang

parent f19a7870
Pipeline #506155 failed with stage
in 6 minutes and 52 seconds
/* (c) https://github.com/MontiCore/monticore */
configuration Network{
num_epoch = 1
batch_size = 10
normalize = false
context = cpu
load_checkpoint = false
optimizer = sgd{
learning_rate = 0.1
learning_rate_decay = 0.85
step_size = 1000
weight_decay = 0.0
}
}
/* (c) https://github.com/MontiCore/monticore */
package metamodels.ddpg;
component Actor {
ports
in T state,
out Q action;
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package metamodels.ddpg;
component Critic {
ports
in Q state,
in Q action,
out Q qvalues;
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package metamodels.ddpg;
import ddpg.Environment;
import ddpg.Reward;
import ddpg.Actor;
import ddpg.Critic;
component DDPG {
instance Environment environment;
instance Reward reward;
instance Actor actor;
instance Critic critic;
// -> environment
// connect actor.action -> environment.action;
// -> critic
connect actor.action -> critic.action;
connect actor.state -> critic.state;
// -> actor
connect critic.state -> actor.state;
// -> reward
connect actor.state -> reward.state;
connect environment.isTerminal -> reward.isTerminal;
connect environment.state -> reward.state;
}
// TODO: components as emadl or ros interface, list of reference models (e.g. ddpg without reward)
// evaluation with mnist
// infogan problem
// finish schemalang and conflang for merge
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package metamodels.ddpg;
component Environment {
ports
in B isTerminal,
in T state,
out Q reward;
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package metamodels.ddpg;
component Reward {
ports
in B isTerminal,
in T state,
out Q reward;
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package metamodels.dqn;
import dqn.Environment;
import dqn.QNetwork;
import dqn.Reward;
import dqn.Policy;
component DQN {
instance Environment environment;
instance QNetwork qnetwork;
instance Reward reward;
instance Policy policy;
connect qnetwork.qvalues -> policy.values;
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package metamodels.dqn;
component Environment {
ports
in T isTerminal,
in T state,
out T reward;
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package metamodels.dqn;
component Policy {
ports
in T values,
out T action;
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package metamodels.dqn;
component QNetwork {
ports
in T state,
out T qvalues;
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package metamodels.dqn;
component Reward {
ports
in T state,
in T isTerminal,
out T reward;
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package metamodels.gan;
component Discriminator {
ports
in T data,
out T dis;
// ports in Q(-1:1)^{1, 64, 64} data,
// out Q(-oo:oo)^{1} dis;
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package metamodels.gan;
import metamodels.gan.Generator;
import metamodels.gan.Discriminator;
component GAN {
instance Generator generator;
instance Discriminator discriminator;
connect generator.data -> discriminator.data;
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package metamodels.gan;
component Generator {
ports
in T noise,
out T data;
// ports in Q(0:1)^{100} noise,
// out Q(-1:1)^{1, 64, 64} data;
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
// package de.serwth.emadl;
// import de.serwth.emadl.Optimizer;
import Optimizer;
schema DDPG /* extends ReinforcementLearning */ {
// reference-model: metamodel.ddpg.DDPG // TODO List of models
critic: component // TODO remove
soft_target_update_rate: Q
critic_optimizer: optimizer
}
/* (c) https://github.com/MontiCore/monticore */
// package de.serwth.emadl;
import Loss;
schema DQN /* extends ReinforcementLearning */ {
// reference-model: metamodel.dqn.DQN
use_fix_target_network: B
target_network_update_interval: N0
use_double_dqn: B
loss: loss
}
/* (c) https://github.com/MontiCore/monticore */
// package de.serwth.emadl;
// import de.serwth.emadl.Optimizer
import Optimizer;
schema GANLearning /* extends General */ {
// reference-model: metamodel.gan.GAN
discriminator_name: component
preprocessing_name: component
qnet_name: component
k_value: N0
generator_target_name: string
noise_input: string
generator_loss_weight: Q
discriminator_loss_weight: Q
print_images: B
batch_size: N0
load_checkpoint: B
checkpoint_period: N0
load_pretrained: B
log_period: N0
normalize: B
num_epoch: N1
loss_weights: Q*
noise_distribution: noise_distribution
discriminator_optimizer: optimizer
generator_loss: generator_loss
noise_distribution {
values:
gaussian,
uniform;
define gaussian {
mean_value: N0
spread_value: N0
}
}
}
/* (c) https://github.com/MontiCore/monticore */
// package de.serwth.emadl;
import Optimizer;
schema General {
/*
schema-links {
learning_method {
supervised -> SupervisedLearning,
reinforcement -> ReinforcementLearning,
gan -> GANLearning;
}
}
*/
learning_method: schema {
supervised -> SupervisedLearning,
reinforcement -> ReinforcementLearning,
gan -> GANLearning;
}
learning_method = supervised: enum { // TODO remove duplicate definitions
supervised,
reinforcement,
gan;
}
context: enum {
cpus,
gpu;
}
optimizer: optimizer
actor_optimizer: optimizer
}
/* (c) https://github.com/MontiCore/monticore */
// package de.serwth.emadl;
/*
* Schema definition for loss.
*/
schema Loss {
loss {
values:
l1,
l2,
epe,
log_cosh,
sigmoid_binary_cross_entropy,
huber,
cross_entropy,
softmax_cross_entropy,
softmax_cross_entropy_ignore_indices,
dice,
hinge,
squared_hinge,
logistic,
kullback_leibler;
define huber {
rho: Q
}
define cross_entropy {
sparse_label: B
loss_axis: Z
batch_axis: Z
}
define softmax_cross_entropy {
sparse_label: B
loss_axis: Z
batch_axis: Z
from_logits: B
}
define softmax_cross_entropy_ignore_indices {
sparse_label: B
loss_axis: Z
batch_axis: Z
from_logits: B
ignore_indices: Z
}
define softmax_cross_entropy_ignore_label {
sparse_label: B
loss_axis: Z
batch_axis: Z
from_logits: B
loss_ignore_label: Z
}
define hinge {
margin: Q
}
define hinge {
label_format: string
}
define kullback_leibler {
from_logits: B
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment