Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**

- OS: \[e.g. iOS\]
- Version \[e.g. 22\]
- OS: [e.g. iOS]
- Version [e.g. 22]
- Python version
- Ludwig version

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ assignees: ''
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when \[...\]
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the use case**
A clear and concise description of what the use case for this feature is.
Expand Down
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-ast
- id: check-byte-order-marker
Expand All @@ -29,43 +29,43 @@ repos:
- id: trailing-whitespace
- id: mixed-line-ending
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.20.0
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/PyCQA/docformatter
rev: v1.5.1
rev: v1.7.7
hooks:
- id: docformatter
args: [--in-place, --wrap-summaries=115, --wrap-descriptions=120]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 6.0.1
hooks:
- id: isort
name: Format imports
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 7.3.0
hooks:
- id: flake8
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 25.1.0
hooks:
- id: black
name: Format code
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
rev: 1.19.1
hooks:
- id: blacken-docs
args: [--line-length=120]
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
rev: 0.7.22
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gfm
- mdformat_frontmatter
exclude: CHANGELOG.md
- repo: https://github.com/yoheimuta/protolint
rev: v0.42.2
rev: v0.55.6
hooks:
- id: protolint
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Work on your self-assigned issue and eventually create a Pull Request.
pip install -e .
```

The above command will install only the packages in "requirements.txt" in the developer mode. If you would like to
The above command will install only the packages in "requirements.txt" in the developer mode. If you would like to
be able to potentially make changes to the overall Ludwig codebase, then use the following command:

```bash
Expand Down Expand Up @@ -93,9 +93,9 @@ Work on your self-assigned issue and eventually create a Pull Request.

1. Finally, if during the installation of `horovod`, the exception `ModuleNotFoundError: No module named 'packaging'`
occurs, you may need to disable `horovod` (that means you will need train with another backend, just not `horovod`).
To do that, edit the file `requirements_extra.txt` and comment out the line that begins with `horovod`. After that,
please execute the long `pip install` command given in the previous step. With these work-around provisions, your
installation should run to completion successfully. If you are still having difficulty, please reach out with the
To do that, edit the file `requirements_extra.txt` and comment out the line that begins with `horovod`. After that,
please execute the long `pip install` command given in the previous step. With these work-around provisions, your
installation should run to completion successfully. If you are still having difficulty, please reach out with the
specifics of your environment in the Ludwig Community [Discord](https://discord.gg/CBgdrGnZjy).

1. Develop features on your branch.
Expand Down
2 changes: 1 addition & 1 deletion README_KR.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pip install ludwig
[Horovod](https://github.com/horovod/horovod)를 통해 분산 학습이 지원되며, `pip install ludwig[horovod]` 또는 `HOROVOD_GPU_OPERATIONS=NCCL pip install ludwig[horovod]` 와 같이 GPU 환경에서 설치가 가능합니다.
설치 가능한 옵션들을 더 확인하고 싶으시다면 Horovod's [installation guide](https://horovod.readthedocs.io/en/stable/install_include.html) 를 참고하시기 바랍니다.

추가하려는 package들은 `pip install ludwig[extra1,extra2,...]` 의 명령어를 통해 설치가 가능합니다. 예를 들어, `pip install ludwig[text,viz]` 와 같은 조합으로 설치가 가능합니다. 모든 파일들을 한 번에 설치하려면 `pip install ludwig[full]`을 사용하면 됩니다.
추가하려는 package들은 `pip install ludwig[extra1,extra2,...]` 의 명령어를 통해 설치가 가능합니다. 예를 들어, `pip install ludwig[text,viz]` 와 같은 조합으로 설치가 가능합니다. 모든 파일들을 한 번에 설치하려면 `pip install ludwig[full]`을 사용하면 됩니다.

소스코드를 repository에서 build하려는 개발자들은 아래와 같은 방법을 사용하면 됩니다.

Expand Down
16 changes: 8 additions & 8 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

This directory contains example programs demonstrating Ludwig's Python APIs.

| Directory | Examples Provided |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| hyperopt | Demonstrates Ludwig's to hyper-parameter optimization capability. |
| kfold_cv | Provides two examples for performing a k-fold cross validation analysis. One example uses the `ludwig experiment` cli. The other example uses the `ludwig.experiment.kfold_cross_validate()` api function. |
| mnist | Creates a model config data structure from a yaml file and trains a model. Programmatically modify the model config data structure to evaluate several different neural network architectures. Jupyter notebook demonstrates using a hold-out test data set to visualize model performance for alternative model architectures. |
| titanic | Trains a simple model with model config contained in a yaml file. Trains multiple models from yaml files and generate visualizations to compare training results. Jupyter notebook demonstrating how to programmatically create visualizations. |
| serve | Demonstrates running Ludwig http model server. A sample Python program illustrates how to invoke the REST API to get predictions from input features. |
| class_imbalance | Demonstrates using our class balancing feature to over-sample an imbalanced dataset. |
| Directory | Examples Provided |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| hyperopt | Demonstrates Ludwig's to hyper-parameter optimization capability. |
| kfold_cv | Provides two examples for performing a k-fold cross validation analysis. One example uses the `ludwig experiment` cli. The other example uses the `ludwig.experiment.kfold_cross_validate()` api function. |
| mnist | Creates a model config data structure from a yaml file and trains a model. Programmatically modify the model config data structure to evaluate several different neural network architectures. Jupyter notebook demonstrates using a hold-out test data set to visualize model performance for alternative model architectures. |
| titanic | Trains a simple model with model config contained in a yaml file. Trains multiple models from yaml files and generate visualizations to compare training results. Jupyter notebook demonstrating how to programmatically create visualizations. |
| serve | Demonstrates running Ludwig http model server. A sample Python program illustrates how to invoke the REST API to get predictions from input features. |
| class_imbalance | Demonstrates using our class balancing feature to over-sample an imbalanced dataset. |
2 changes: 1 addition & 1 deletion examples/hyperopt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Demonstrates hyperparameter optimization using Ludwig's in-built capabilities.
### Preparatory Steps

- Create `data` directory
- Download [Kaggle wine quality data set](https://www.kaggle.com/rajyellow46/wine-quality) into the `data` directory. Directory should
- Download [Kaggle wine quality data set](https://www.kaggle.com/rajyellow46/wine-quality) into the `data` directory. Directory should
appear as follows:

```
Expand Down
12 changes: 6 additions & 6 deletions examples/mnist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ This API example is based on [Ludwig's MNIST Hand-written Digit image classifica

### Examples

| File | Description |
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| simple_model_training.py | Demonstrates using Ludwig api for training a model. |
| advance_model_training.py | Demonstrates a method to assess alternative model architectures. |
| assess_model_performance.py | Assess model performance on hold-out test data set. This shows how to load a previously trained model to make predictions. |
| visualize_model_test_results.ipynb | Example for extracting training statistics and generate custom visualizations. |
| File | Description |
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| simple_model_training.py | Demonstrates using Ludwig api for training a model. |
| advance_model_training.py | Demonstrates a method to assess alternative model architectures. |
| assess_model_performance.py | Assess model performance on hold-out test data set. This shows how to load a previously trained model to make predictions. |
| visualize_model_test_results.ipynb | Example for extracting training statistics and generate custom visualizations. |
4 changes: 2 additions & 2 deletions examples/serve/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Ludwig Model Serve Example

This example shows Ludwig's http model serving capability, which is able to load a pre-trained Ludwig model and respond to REST APIs for predictions.
A simple client program illustrates how to invoke the REST API to retrieve predictions for provided input features. The two REST APIs covered by this example:
A simple client program illustrates how to invoke the REST API to retrieve predictions for provided input features. The two REST APIs covered by this example:

| REST API | Description |
| ---------------- | ------------------------------- |
Expand All @@ -27,7 +27,7 @@ examples/
- Open two terminal windows
- In first terminal window:
- Ensure current working directory is `examples/serve`
- Start ludwig model server with the `titanic` trained model. The following command uses the default host address (`0.0.0.0`) and port number (`8000`).
- Start ludwig model server with the `titanic` trained model. The following command uses the default host address (`0.0.0.0`) and port number (`8000`).

```
ludwig serve --model_path ../titanic/results/simple_experiment_simple_model/model
Expand Down
4 changes: 2 additions & 2 deletions examples/titanic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ The Titanic dataset is hosted by Kaggle, and as such Ludwig will need to authent
| multiple_model_training.py | Trains two models and generates a visualization for results of training. |
| model_training_results.ipynb | Example for extracting training statistics and generate custom visualizations. |

Enter `python simple_model_training.py` will train a single model. Results of model training will be stored in this location.
Enter `python simple_model_training.py` will train a single model. Results of model training will be stored in this location.

```
./results/
simple_experiment_simple_model/
```

Enter `python multiple_model_training.py` will train two models and generate standard Ludwig visualizations comparing the
two models. Results will in the following directories:
two models. Results will in the following directories:

```
./results/
Expand Down
2 changes: 1 addition & 1 deletion examples/wine_quality/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Demonstrates how to use Ludwig's defaults section introduced in v0.6.
### Preparatory Steps

- Create `data` directory
- Download [Kaggle wine quality data set](https://www.kaggle.com/rajyellow46/wine-quality) into the `data` directory. Directory should
- Download [Kaggle wine quality data set](https://www.kaggle.com/rajyellow46/wine-quality) into the `data` directory. Directory should
appear as follows:

```
Expand Down
23 changes: 10 additions & 13 deletions ludwig/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
# limitations under the License.
# ==============================================================================
"""
File name: LudwigModel.py
Author: Piero Molino
Date created: 5/21/2019
Python Version: 3+
File name: LudwigModel.py
Author: Piero Molino
Date created: 5/21/2019
Python Version: 3+
"""
import copy
import dataclasses
Expand Down Expand Up @@ -2015,9 +2015,9 @@ def to_torchscript(
# Inputs

:param model_only (bool, optional): If True, only the ECD model will be converted to Torchscript. Else,
preprocessing and postprocessing steps will also be converted to Torchscript.
:param device (TorchDevice, optional): If None, the model will be converted to Torchscript on the same device to
ensure maximum model parity.
preprocessing and postprocessing steps will also be converted to Torchscript. :param device (TorchDevice,
optional): If None, the model will be converted to Torchscript on the same device to ensure maximum model
parity.

# Returns

Expand Down Expand Up @@ -2086,11 +2086,8 @@ def create_model(config_obj: Union[ModelConfig, dict], random_seed: int = defaul

# Inputs
:param config_obj: (Union[Config, dict]) Ludwig config object
:param random_seed: (int, default: ludwig default random seed) Random
seed used for weights initialization,
splits and any other random function.

# Return
:param random_seed: (int, default: ludwig default random seed) Random seed used for weights initialization,
splits and any other random function. # Return
:return: (ludwig.models.BaseModel) Instance of the Ludwig model object.
"""
if isinstance(config_obj, dict):
Expand Down Expand Up @@ -2136,7 +2133,7 @@ def is_merge_and_unload_set(self) -> bool:

# Return

:return (bool): whether merge_and_unload should be done.
:return (bool): whether merge_and_unload should be done.
"""
# TODO: In the future, it may be possible to move up the model type check into the BaseModel class.
return self.config_obj.model_type == MODEL_LLM and self.model.is_merge_and_unload_set()
Expand Down
1 change: 1 addition & 0 deletions ludwig/automl/automl.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
(2) Tunes config based on resource constraints
(3) Runs hyperparameter optimization experiment
"""

import argparse
import copy
import logging
Expand Down
Loading