Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Hi! I Was Taking A Look At The

Yes AgitatedDove14 , I am not sure what they use by default. Here is a simple working example:
` from typing import Optional

import torch
from clearml import Task
from pytorch_lightning import LightningDataModule, LightningModule
from pytorch_lightning.utilities.cli import LightningCLI
from torch.utils.data import DataLoader, Dataset, Subset

class RandomDataset(Dataset):
def init(self, size, length):
self.len = length
self.data = torch.randn(length, size)

def __getitem__(self, index):
    return self.data[index]

def __len__(self):
    return self.len

class BoringModel(LightningModule):
def init(self):
Testing PL Module

    Use as follows:
    - subclass
    - modify the behavior for what you want

    class TestModel(BaseTestModel):
        def training_step(...):
            # do your own thing


    model = BaseTestModel()
    model.training_epoch_end = None

    self.layer = torch.nn.Linear(32, 2)

def forward(self, x):
    return self.layer(x)

def loss(self, batch, prediction):
    # An arbitrary loss to have a loss that updates the model weights during `Trainer.fit` calls
    return torch.nn.functional.mse_loss(prediction, torch.ones_like(prediction))

def step(self, x):
    x = self(x)
    out = torch.nn.functional.mse_loss(x, torch.ones_like(x))
    return out

def training_step(self, batch, batch_idx):
    output = self(batch)
    loss = self.loss(batch, output)
    return {"loss": loss}

def training_step_end(self, training_step_outputs):
    return training_step_outputs

def training_epoch_end(self, outputs) -> None:
    torch.stack([x["loss"] for x in outputs]).mean()

def validation_step(self, batch, batch_idx):
    output = self(batch)
    loss = self.loss(batch, output)
    return {"x": loss}

def validation_epoch_end(self, outputs) -> None:
    torch.stack([x["x"] for x in outputs]).mean()

def test_step(self, batch, batch_idx):
    output = self(batch)
    loss = self.loss(batch, output)
    return {"y": loss}

def test_epoch_end(self, outputs) -> None:
    torch.stack([x["y"] for x in outputs]).mean()

def configure_optimizers(self):
    optimizer = torch.optim.SGD(self.layer.parameters(), lr=0.1)
    lr_scheduler = torch.optim.lr_scheduler.StepLR(optimizer, step_size=1)
    return [optimizer], [lr_scheduler]

def train_dataloader(self):
    return DataLoader(RandomDataset(32, 64))

def val_dataloader(self):
    return DataLoader(RandomDataset(32, 64))

def test_dataloader(self):
    return DataLoader(RandomDataset(32, 64))

def predict_dataloader(self):
    return DataLoader(RandomDataset(32, 64))

class BoringDataModule(LightningDataModule):
def init(self, data_dir: str = "./"):
self.data_dir = data_dir
self.non_picklable = None
self.checkpoint_state: Optional[str] = None

def prepare_data(self):
    self.random_full = RandomDataset(32, 64 * 4)

def setup(self, stage: Optional[str] = None):
    if stage == "fit" or stage is None:
        self.random_train = Subset(self.random_full, indices=range(64))
        self.dims = self.random_train[0].shape

    if stage in ("fit", "validate") or stage is None:
        self.random_val = Subset(self.random_full, indices=range(64, 64 * 2))

    if stage == "test" or stage is None:
        self.random_test = Subset(self.random_full, indices=range(64 * 2, 64 * 3))
        self.dims = getattr(self, "dims", self.random_test[0].shape)

    if stage == "predict" or stage is None:
        self.random_predict = Subset(
            self.random_full, indices=range(64 * 3, 64 * 4)
        self.dims = getattr(self, "dims", self.random_predict[0].shape)

def train_dataloader(self):
    return DataLoader(self.random_train)

def val_dataloader(self):
    return DataLoader(self.random_val)

def test_dataloader(self):
    return DataLoader(self.random_test)

def predict_dataloader(self):
    return DataLoader(self.random_predict)

if name == "main":
task = Task.init(project_name="examples")
cli = LightningCLI(BoringModel, BoringDataModule) The expected behavior would be to have both the LightningDataModule and LightningModule ` parameters on the configuration tab > args of the UI but they are not there.

Posted 2 years ago
0 Answers
2 years ago
11 months ago