kalatorch


Namekalatorch JSON
Version 0.0.0 PyPI version JSON
download
home_pagehttps://github.com/Kalasaikamesh944/KalaTorch.git
SummaryA high-level PyTorch framework for easy implementation of AI models and neural networks.
upload_time2024-12-13 07:40:16
maintainerNone
docs_urlNone
authorN V R K SAI KAMESH YADAVALLI
requires_python>=3.7
licenseMIT
keywords pytorch ai machine-learning deep-learning neural-networks
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # KalaTorch

**KalaTorch** is a high-level PyTorch framework designed to simplify the implementation of neural networks and AI models. It provides prebuilt utilities for creating models, managing datasets, and training workflows, making it easier to develop machine learning solutions.

---

## Features

- **Modular Design:** Easily extend and customize for various use cases.
- **Predefined Architectures:** Includes utilities to create convolutional, recurrent, and transformer models.
- **Dataset Management:** Simplifies dataset creation and DataLoader configuration.
- **Trainer Class:** High-level API for training and evaluation workflows.

---

## Installation

1. Clone the repository:
   ```bash
   git clone https://github.com/Kalasaikamesh944/KalaTorch.git
   cd KalaTorch
   ```

2. Install the required dependencies:
   ```bash
   pip install -r requirements.txt
   ```

3. Alternatively, install directly using pip (coming soon):
   ```bash
   pip install kalatorch
   ```

---

## Usage

### Example: Training a Model

```python
import torch
import torch.nn as nn
from KalaTorch.models import create_convnet
from KalaTorch.datasets import create_data_loader
from KalaTorch.training import KaloTrainer
import torch.optim as optim

# Define dataset
X = torch.randn(100, 1, 28, 28)  # 100 samples of 28x28 grayscale images
y = torch.randint(0, 10, (100,))  # Labels for 10 classes

# Create data loaders
train_loader = create_data_loader(X[:80], y[:80], batch_size=16)
val_loader = create_data_loader(X[80:], y[80:], batch_size=16)

# Create a convolutional model
model = create_convnet(input_channels=1, num_classes=10)

# Define optimizer and loss function
optimizer = optim.Adam(model.parameters(), lr=0.001)
criterion = nn.CrossEntropyLoss()

# Initialize the trainer
trainer = KaloTrainer(model, optimizer, criterion)

# Train the model
trainer.train(train_loader, epochs=5)

# Evaluate the model
trainer.evaluate(val_loader)
```

---

## Modules and APIs

### 1. **Models**

#### `create_convnet(input_channels, num_classes)`
- Builds a convolutional neural network.
- **Parameters:**
  - `input_channels` (int): Number of input channels (e.g., 1 for grayscale, 3 for RGB).
  - `num_classes` (int): Number of output classes.

#### `create_recurrent(input_size, hidden_size, num_layers, num_classes)`
- Builds a recurrent neural network.
- **Parameters:**
  - `input_size` (int): Dimensionality of the input features.
  - `hidden_size` (int): Number of hidden units per layer.
  - `num_layers` (int): Number of RNN layers.
  - `num_classes` (int): Number of output classes.

#### `create_transformer(input_dim, num_heads, num_layers, num_classes)`
- Builds a transformer-based model.
- **Parameters:**
  - `input_dim` (int): Dimensionality of input features.
  - `num_heads` (int): Number of attention heads.
  - `num_layers` (int): Number of encoder layers.
  - `num_classes` (int): Number of output classes.

---

### 2. **Datasets**

#### `create_data_loader(data, labels, batch_size=32, shuffle=True)`
- Creates a PyTorch DataLoader for the given dataset.
- **Parameters:**
  - `data` (torch.Tensor): Input features.
  - `labels` (torch.Tensor): Ground truth labels.
  - `batch_size` (int): Size of each batch (default: 32).
  - `shuffle` (bool): Whether to shuffle the data (default: True).

---

### 3. **Training**

#### `KaloTrainer`
- A class for managing training and evaluation workflows.

**Methods:**

- `train(train_loader, epochs=10)`
  - Trains the model for the specified number of epochs.
  - **Parameters:**
    - `train_loader`: DataLoader for training data.
    - `epochs` (int): Number of training epochs (default: 10).

- `evaluate(val_loader)`
  - Evaluates the model on the validation dataset.
  - **Parameters:**
    - `val_loader`: DataLoader for validation data.

---

## Project Structure

```
KalaTorch/
├── datasets/                 # Dataset utilities
│   ├── __init__.py
│   ├── dataloader.py
├── models/                   # Predefined models
│   ├── __init__.py
│   ├── convnet.py
│   ├── recurrent.py
│   ├── transformer.py
├── training/                 # Training utilities
│   ├── __init__.py
│   ├── trainer.py
├── utils/                    # Optional 
└── train.py                  # Example training script
```

---

## Running Tests

To run unit tests:
```bash
python -m unittest discover tests
```

---

## License

KalaTorch is licensed under the MIT License. See the LICENSE file for details.

---

## Contributing

Contributions are welcome! Please follow these steps:
1. Fork the repository.
2. Create a feature branch (`git checkout -b feature-name`).
3. Commit your changes (`git commit -m 'Add feature'`).
4. Push to the branch (`git push origin feature-name`).
5. Open a pull request.

---

For more details, visit the [repository](https://github.com/Kalasaikamesh944/KalaTorch.git).


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Kalasaikamesh944/KalaTorch.git",
    "name": "kalatorch",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "pytorch ai machine-learning deep-learning neural-networks",
    "author": "N V R K SAI KAMESH YADAVALLI",
    "author_email": "your_email@example.com",
    "download_url": "https://files.pythonhosted.org/packages/f0/9b/da0c3ce2fc172c8a9d84feef1eeaf09c91b6d581e5ba90ef7800c90758cf/kalatorch-0.0.0.tar.gz",
    "platform": null,
    "description": "# KalaTorch\n\n**KalaTorch** is a high-level PyTorch framework designed to simplify the implementation of neural networks and AI models. It provides prebuilt utilities for creating models, managing datasets, and training workflows, making it easier to develop machine learning solutions.\n\n---\n\n## Features\n\n- **Modular Design:** Easily extend and customize for various use cases.\n- **Predefined Architectures:** Includes utilities to create convolutional, recurrent, and transformer models.\n- **Dataset Management:** Simplifies dataset creation and DataLoader configuration.\n- **Trainer Class:** High-level API for training and evaluation workflows.\n\n---\n\n## Installation\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/Kalasaikamesh944/KalaTorch.git\n   cd KalaTorch\n   ```\n\n2. Install the required dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. Alternatively, install directly using pip (coming soon):\n   ```bash\n   pip install kalatorch\n   ```\n\n---\n\n## Usage\n\n### Example: Training a Model\n\n```python\nimport torch\nimport torch.nn as nn\nfrom KalaTorch.models import create_convnet\nfrom KalaTorch.datasets import create_data_loader\nfrom KalaTorch.training import KaloTrainer\nimport torch.optim as optim\n\n# Define dataset\nX = torch.randn(100, 1, 28, 28)  # 100 samples of 28x28 grayscale images\ny = torch.randint(0, 10, (100,))  # Labels for 10 classes\n\n# Create data loaders\ntrain_loader = create_data_loader(X[:80], y[:80], batch_size=16)\nval_loader = create_data_loader(X[80:], y[80:], batch_size=16)\n\n# Create a convolutional model\nmodel = create_convnet(input_channels=1, num_classes=10)\n\n# Define optimizer and loss function\noptimizer = optim.Adam(model.parameters(), lr=0.001)\ncriterion = nn.CrossEntropyLoss()\n\n# Initialize the trainer\ntrainer = KaloTrainer(model, optimizer, criterion)\n\n# Train the model\ntrainer.train(train_loader, epochs=5)\n\n# Evaluate the model\ntrainer.evaluate(val_loader)\n```\n\n---\n\n## Modules and APIs\n\n### 1. **Models**\n\n#### `create_convnet(input_channels, num_classes)`\n- Builds a convolutional neural network.\n- **Parameters:**\n  - `input_channels` (int): Number of input channels (e.g., 1 for grayscale, 3 for RGB).\n  - `num_classes` (int): Number of output classes.\n\n#### `create_recurrent(input_size, hidden_size, num_layers, num_classes)`\n- Builds a recurrent neural network.\n- **Parameters:**\n  - `input_size` (int): Dimensionality of the input features.\n  - `hidden_size` (int): Number of hidden units per layer.\n  - `num_layers` (int): Number of RNN layers.\n  - `num_classes` (int): Number of output classes.\n\n#### `create_transformer(input_dim, num_heads, num_layers, num_classes)`\n- Builds a transformer-based model.\n- **Parameters:**\n  - `input_dim` (int): Dimensionality of input features.\n  - `num_heads` (int): Number of attention heads.\n  - `num_layers` (int): Number of encoder layers.\n  - `num_classes` (int): Number of output classes.\n\n---\n\n### 2. **Datasets**\n\n#### `create_data_loader(data, labels, batch_size=32, shuffle=True)`\n- Creates a PyTorch DataLoader for the given dataset.\n- **Parameters:**\n  - `data` (torch.Tensor): Input features.\n  - `labels` (torch.Tensor): Ground truth labels.\n  - `batch_size` (int): Size of each batch (default: 32).\n  - `shuffle` (bool): Whether to shuffle the data (default: True).\n\n---\n\n### 3. **Training**\n\n#### `KaloTrainer`\n- A class for managing training and evaluation workflows.\n\n**Methods:**\n\n- `train(train_loader, epochs=10)`\n  - Trains the model for the specified number of epochs.\n  - **Parameters:**\n    - `train_loader`: DataLoader for training data.\n    - `epochs` (int): Number of training epochs (default: 10).\n\n- `evaluate(val_loader)`\n  - Evaluates the model on the validation dataset.\n  - **Parameters:**\n    - `val_loader`: DataLoader for validation data.\n\n---\n\n## Project Structure\n\n```\nKalaTorch/\n\u251c\u2500\u2500 datasets/                 # Dataset utilities\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u251c\u2500\u2500 dataloader.py\n\u251c\u2500\u2500 models/                   # Predefined models\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u251c\u2500\u2500 convnet.py\n\u2502   \u251c\u2500\u2500 recurrent.py\n\u2502   \u251c\u2500\u2500 transformer.py\n\u251c\u2500\u2500 training/                 # Training utilities\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u251c\u2500\u2500 trainer.py\n\u251c\u2500\u2500 utils/                    # Optional \n\u2514\u2500\u2500 train.py                  # Example training script\n```\n\n---\n\n## Running Tests\n\nTo run unit tests:\n```bash\npython -m unittest discover tests\n```\n\n---\n\n## License\n\nKalaTorch is licensed under the MIT License. See the LICENSE file for details.\n\n---\n\n## Contributing\n\nContributions are welcome! Please follow these steps:\n1. Fork the repository.\n2. Create a feature branch (`git checkout -b feature-name`).\n3. Commit your changes (`git commit -m 'Add feature'`).\n4. Push to the branch (`git push origin feature-name`).\n5. Open a pull request.\n\n---\n\nFor more details, visit the [repository](https://github.com/Kalasaikamesh944/KalaTorch.git).\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A high-level PyTorch framework for easy implementation of AI models and neural networks.",
    "version": "0.0.0",
    "project_urls": {
        "Homepage": "https://github.com/Kalasaikamesh944/KalaTorch.git"
    },
    "split_keywords": [
        "pytorch",
        "ai",
        "machine-learning",
        "deep-learning",
        "neural-networks"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c3f9ef1ee7e112df8cbee96f01390246558426cde6c235fd02a5ff47e87bd2c",
                "md5": "3a82a09675e953568a63b6b6f32cb8aa",
                "sha256": "d188d2cc988c88295cb4460eb5ddd2b4796ea0d1c55046d9ce8db204160913ab"
            },
            "downloads": -1,
            "filename": "kalatorch-0.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3a82a09675e953568a63b6b6f32cb8aa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 6677,
            "upload_time": "2024-12-13T07:40:13",
            "upload_time_iso_8601": "2024-12-13T07:40:13.637916Z",
            "url": "https://files.pythonhosted.org/packages/0c/3f/9ef1ee7e112df8cbee96f01390246558426cde6c235fd02a5ff47e87bd2c/kalatorch-0.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f09bda0c3ce2fc172c8a9d84feef1eeaf09c91b6d581e5ba90ef7800c90758cf",
                "md5": "816d0a20d39c1cefa530977b4504caca",
                "sha256": "90a0d8bec45fe8abe89783d67ae8bc07479dd1ed0aa6db51299c779fffaafaa2"
            },
            "downloads": -1,
            "filename": "kalatorch-0.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "816d0a20d39c1cefa530977b4504caca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 4930,
            "upload_time": "2024-12-13T07:40:16",
            "upload_time_iso_8601": "2024-12-13T07:40:16.422104Z",
            "url": "https://files.pythonhosted.org/packages/f0/9b/da0c3ce2fc172c8a9d84feef1eeaf09c91b6d581e5ba90ef7800c90758cf/kalatorch-0.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-13 07:40:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Kalasaikamesh944",
    "github_project": "KalaTorch",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "kalatorch"
}
        
Elapsed time: 0.45341s