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

📖 Library Component Descriptions Update #180

Merged
merged 14 commits into from
Jul 29, 2022
Merged
6 changes: 3 additions & 3 deletions examples/TorchPredictFromModel.xircuits
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@
"extras": {
"type": "debug",
"path": "xai_components/xai_pytorch/quickstart.py",
"description": "Converts an image loaded from path to a torch tensor.\n\n### inPorts:\n- img_path: image path.\n- resize: tuple with desired tensor dimension.\n If not provided, will use original image dimensions.\n\n### outPorts:\n- tensor: a torch tensor instance.",
"description": "Converts an image loaded from path to a torch tensor.\n\n##### inPorts:\n- img_path: image path.\n- resize: tuple with desired tensor dimension.\n If not provided, will use original image dimensions.\n\n##### outPorts:\n- tensor: a torch tensor instance.",
"lineNo": [
{
"lineno": 387,
Expand Down Expand Up @@ -774,7 +774,7 @@
"extras": {
"type": "debug",
"path": "xai_components/xai_pytorch/quickstart.py",
"description": "Creates a custom Torch Model config.\n\n### outPorts:\n- model: torch nn instance that expects a 28*28 input.\n- loss_fn: nn.CrossEntropyLoss()\n- optimizer: torch.optim.SGD(model.parameters(), lr=1e-3)",
"description": "Creates a custom Torch Model config.\n\n##### outPorts:\n- model: torch nn instance that expects a 28*28 input.\n- loss_fn: nn.CrossEntropyLoss()\n- optimizer: torch.optim.SGD(model.parameters(), lr=1e-3)",
"lineNo": [
{
"lineno": 123,
Expand Down Expand Up @@ -872,7 +872,7 @@
"extras": {
"type": "debug",
"path": "xai_components/xai_pytorch/quickstart.py",
"description": "Loads a Torch model's state from a previously saved .pth.\n\n### inPorts:\n- model_config: torch nn config instance. \n- model_path: the saved model path.\n\n### outPorts:\n- loaded_model: torch nn model with loaded state. ",
"description": "Loads a Torch model's state from a previously saved .pth.\n\n##### inPorts:\n- model_config: torch nn config instance. \n- model_path: the saved model path.\n\n##### outPorts:\n- loaded_model: torch nn model with loaded state. ",
"lineNo": [
{
"lineno": 315,
Expand Down
10 changes: 5 additions & 5 deletions examples/TorchTrainModel.xircuits
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@
"extras": {
"type": "debug",
"path": "xai_components/xai_pytorch/quickstart.py",
"description": "Creates data iterators from torch datasets. \nTo be used with `LoadTorchVisionDataset` component.\n\n### inPorts:\n- training_data: Torch Dataset of training data.\n- test_data: Torch Dataset of test data.\n- batch_size: batch size to iterate though.\n Default: 64\n\n### outPorts:\n- train_dataloader: Dataloader instance for training data.\n- test_dataloader: Dataloader instance for test data.",
"description": "Creates data iterators from torch datasets. \nTo be used with `LoadTorchVisionDataset` component.\n\n##### inPorts:\n- training_data: Torch Dataset of training data.\n- test_data: Torch Dataset of test data.\n- batch_size: batch size to iterate though.\n Default: 64\n\n##### outPorts:\n- train_dataloader: Dataloader instance for training data.\n- test_dataloader: Dataloader instance for test data.",
"lineNo": [
{
"lineno": 71,
Expand Down Expand Up @@ -1000,7 +1000,7 @@
"extras": {
"type": "debug",
"path": "xai_components/xai_pytorch/quickstart.py",
"description": "Creates a custom Torch Model config.\n\n### outPorts:\n- model: torch nn instance that expects a 28*28 input.\n- loss_fn: nn.CrossEntropyLoss()\n- optimizer: torch.optim.SGD(model.parameters(), lr=1e-3)",
"description": "Creates a custom Torch Model config.\n\n##### outPorts:\n- model: torch nn instance that expects a 28*28 input.\n- loss_fn: nn.CrossEntropyLoss()\n- optimizer: torch.optim.SGD(model.parameters(), lr=1e-3)",
"lineNo": [
{
"lineno": 123,
Expand Down Expand Up @@ -1103,7 +1103,7 @@
"extras": {
"type": "debug",
"path": "xai_components/xai_pytorch/quickstart.py",
"description": "Trains a Torch model instance from a dataloader. \n\n### inPorts:\n- train_dataloader: torch dataloader util instance. Ideally from `TorchDataLoader`.\n- model: torch nn instance.\n- loss_fn: torch nn loss function.\n- optimizer: torch model optimizer.\n- epochs: training epochs. \n Default: `5`.\n\n### outPorts:\n- trained_model: trained torch nn instance. ",
"description": "Trains a Torch model instance from a dataloader. \n\n##### inPorts:\n- train_dataloader: torch dataloader util instance. Ideally from `TorchDataLoader`.\n- model: torch nn instance.\n- loss_fn: torch nn loss function.\n- optimizer: torch model optimizer.\n- epochs: training epochs. \n Default: `5`.\n\n##### outPorts:\n- trained_model: trained torch nn instance. ",
"lineNo": [
{
"lineno": 178,
Expand Down Expand Up @@ -1251,7 +1251,7 @@
"extras": {
"type": "debug",
"path": "xai_components/xai_pytorch/quickstart.py",
"description": "Loads a Torch Vision dataset.\n\n### Reference:\n- [Pytorch Vision Datasets](https://pytorch.org/vision/stable/datasets.html#built-in-datasets)\n\n### inPorts:\n- dataset_name: Loads a valid Pytorch Vision dataset, downloads from the \nrepository if not present in `dataset_dir`. \n- dataset_dir: Path to save downloaded Pytorch Vision dataset.\n Default: `./data`.\n\n### outPorts:\n- training_data: train split of the dataset.\n- test_data: test split of the dataset.",
"description": "Loads a Torch Vision dataset.\n\n### Reference:\n- [Pytorch Vision Datasets](https://pytorch.org/vision/stable/datasets.html#built-in-datasets)\n\n##### inPorts:\n- dataset_name: Loads a valid Pytorch Vision dataset, downloads from the \nrepository if not present in `dataset_dir`. \n- dataset_dir: Path to save downloaded Pytorch Vision dataset.\n Default: `./data`.\n\n##### outPorts:\n- training_data: train split of the dataset.\n- test_data: test split of the dataset.",
"lineNo": [
{
"lineno": 10,
Expand Down Expand Up @@ -1366,7 +1366,7 @@
"extras": {
"type": "debug",
"path": "xai_components/xai_pytorch/quickstart.py",
"description": "Tests a Torch model instance from a dataloader. \n\n### inPorts:\n- test_dataloader: torch dataloader util instance. Ideally from `TorchDataLoader`.\n- model: torch nn instance. Ideally trained.\n- loss_fn: torch nn loss function.",
"description": "Tests a Torch model instance from a dataloader. \n\n##### inPorts:\n- test_dataloader: torch dataloader util instance. Ideally from `TorchDataLoader`.\n- model: torch nn instance. Ideally trained.\n- loss_fn: torch nn loss function.",
"lineNo": [
{
"lineno": 245,
Expand Down
2 changes: 1 addition & 1 deletion xai_components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def do(self, ctx) -> BaseComponent:
return self.when_false


@xai_component(type="if")
@xai_component
class LoopComponent(Component):
body: Component

Expand Down
52 changes: 0 additions & 52 deletions xai_components/xai_learning/inference.py

This file was deleted.

Loading