ludwig-ai / ludwig

Low-code framework for building custom LLMs, neural networks, and other AI models

Home Page:http://ludwig.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to create visualizations using Python API

sanjaydasgupta opened this issue · comments

Describe the bug
When attempting to use the Python API's visualization functions as described here, the following error message is produced:
AttributeError: module 'ludwig' has no attribute 'visualize'

To Reproduce
Steps to reproduce the behavior:

  1. Enter the following lines of Python code:
!pip uninstall -y tensorflow --quiet
!pip install ludwig --quiet
!pip install ludwig[llm] --quiet

import ludwig

print(ludwig.visualize.learning_curves)
  1. Try to run the above lines.

  2. See error (AttributeError: module 'ludwig' has no attribute 'visualize')

Expected behavior
A line of output like the following:
<function learning_curves at 0x7bd4f5b52e60>

Screenshots
The above description is complete, and does not need a screenshot.

Environment (please complete the following information):

  • OS: Ubuntu
  • Version 22.04.3 LTS
  • Python version: 3.10.12
  • Ludwig version: 0.9.3

Additional context
The above code was attempted to be run in Google Colab

Please try:
from ludwig.visualize import learning_curves

Oh (silly me). Thanks!

After correcting the import line I got this error: ModuleNotFoundError: No module named 'ptitprince'

However, adding a pip install ptitprince solves the problem.

@sanjaydasgupta I believe ptitprince should have been installed. Did you try pip install "ludwig[viz]"? Visualizations don't come prepackaged when you pip install ludwig and its dependencies live in a separate requirements file.

This is being addressed in a documentation pull request. Thanks.

@sanjaydasgupta The fix has been merged; it will be available at the next release of the Ludwig documentation (for now, it is in the master branch). It turns out that the appropriate fix is not through the Ludwig code, but rather through Ludwig documentation. Thanks for discovering and reporting it!