Skip to content

Commit

Permalink
move actions from core, stop from being a provider module
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonmr committed Apr 28, 2021
1 parent 209a337 commit c42a451
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
8 changes: 0 additions & 8 deletions anvil/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import torch
import torch.nn as nn

from reportengine import collect

ACTIVATION_LAYERS = {
"leaky_relu": nn.LeakyReLU,
Expand Down Expand Up @@ -74,10 +73,3 @@ def forward(self, v_in: torch.tensor):
shape (n_batch, size_out)
"""
return self.network(v_in)

_normalising_flow = collect("model_action", ("model_params",))

def model_to_load(_normalising_flow):
return _normalising_flow[0]


9 changes: 8 additions & 1 deletion anvil/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"""
from functools import partial

from anvil.core import Sequential
from reportengine import collect

from anvil.core import Sequential
import anvil.layers as layers


Expand Down Expand Up @@ -103,6 +104,12 @@ def affine_spline(real_nvp, rational_quadratic_spline):
return Sequential(real_nvp, rational_quadratic_spline)


_normalising_flow = collect("model_action", ("model_params",))

def model_to_load(_normalising_flow):
return _normalising_flow[0]


MODEL_OPTIONS = {
"nice": nice,
"real_nvp": real_nvp,
Expand Down
1 change: 0 additions & 1 deletion anvil/scripts/anvil_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
log = logging.getLogger(__name__)

PROVIDERS = [
"anvil.core",
"anvil.models",
"anvil.sample",
"anvil.models",
Expand Down
2 changes: 1 addition & 1 deletion anvil/scripts/anvil_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

log = logging.getLogger(__name__)

PROVIDERS = ["anvil.train", "anvil.checkpoint", "anvil.core", "anvil.models"]
PROVIDERS = ["anvil.train", "anvil.checkpoint", "anvil.models"]

TRAINING_ACTIONS = ["train"]

Expand Down

0 comments on commit c42a451

Please sign in to comment.