ludwig-ai / ludwig

Low-code framework for building custom LLMs, neural networks, and other AI models
http://ludwig.ai
Apache License 2.0
11.18k stars 1.19k forks source link

ModuleNotFoundError: No module named 'ray.air.checkpoint' #3765

Closed andysingal closed 3 weeks ago

andysingal commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Please provide code, yaml config file and a sample of data in order to entirely reproduce the issue. Issues that are not reproducible will be ignored.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context Add any other context about the problem here.

import logging
import pprint

from ludwig.automl import create_auto_config
from ludwig.datasets import mushroom_edibility
from ludwig.utils.dataset_utils import get_repeatable_train_val_test_split

mushroom_df = mushroom_edibility.load()
mushroom_edibility_df = get_repeatable_train_val_test_split(mushroom_df, 'class', random_seed=42)

auto_config = create_auto_config(
    dataset=mushroom_edibility_df,
    target='class',
    time_limit_s=7200,
    tune_for_memory=False,
    user_config={'preprocessing': {'split': {'column': 'split', 'type': 'fixed'}}},
)

pprint.pprint(auto_config)
justinxzhao commented 1 year ago

Hi @andysingal, which version of ray are you using? Ludwig requires ray v2.3.1.

andysingal commented 1 year ago

Hi @andysingal, which version of ray are you using? Ludwig requires ray v2.3.1.

Thanks for your instant reply, i used https://pypi.org/project/ray/

# Prerequisite: Installs the latest version of Ludwig in the Colab environment
%pip uninstall -y tensorflow --quiet
%pip install ludwig --quiet
%pip install ludwig[viz] --quiet
%pip install ray==2.3.1  --quiet

import logging
import pprint

from ludwig.automl import auto_train
from ludwig.datasets import walmart_recruiting
from ludwig.utils.dataset_utils import get_repeatable_train_val_test_split

walmart_df = walmart_recruiting.load()
walmart_recruiting_df = get_repeatable_train_val_test_split(walmart_df, 'TripType', random_seed=42)

auto_train_results = auto_train(
    dataset=walmart_recruiting_df,
    target='TripType',
    time_limit_s=3600,
    tune_for_memory=False,
    user_config={'output_features': [{'column': 'TripType', 'name': 'TripType', 'type': 'category'}],
        'preprocessing': {'split': {'column': 'split', 'type': 'fixed'}}},
)

pprint.pprint(auto_train_results)

Now the error is:

WARNING:ludwig.datasets.loaders.dataset_loader:Finding fallback mirrors to download the dataset. Downloading from the original source failed with the following error Could not find kaggle.json. Make sure it's located in /root/.kaggle. Or use the environment method..
ERROR:ludwig.datasets.loaders.dataset_loader:No fallback mirror found. Failed to download dataset walmart_recruiting.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/ludwig/datasets/loaders/dataset_loader.py", line 262, in _download_and_process
    self.download(kaggle_username=kaggle_username, kaggle_key=kaggle_key)
  File "/usr/local/lib/python3.10/dist-packages/ludwig/datasets/loaders/dataset_loader.py", line 307, in download
    return download_kaggle_dataset(
  File "/usr/local/lib/python3.10/dist-packages/ludwig/datasets/kaggle.py", line 40, in download_kaggle_dataset
    api = create_kaggle_client()
  File "/usr/local/lib/python3.10/dist-packages/ludwig/datasets/kaggle.py", line 10, in create_kaggle_client
    from kaggle import api
  File "/usr/local/lib/python3.10/dist-packages/kaggle/__init__.py", line 23, in <module>
    api.authenticate()
  File "/usr/local/lib/python3.10/dist-packages/kaggle/api/kaggle_api_extended.py", line 403, in authenticate
    raise IOError('Could not find {}. Make sure it\'s located in'
OSError: Could not find kaggle.json. Make sure it's located in /root/.kaggle. Or use the environment method.
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
[<ipython-input-2-beaacd92f0c6>](https://localhost:8080/#) in <cell line: 8>()
      6 from ludwig.utils.dataset_utils import get_repeatable_train_val_test_split
      7 
----> 8 walmart_df = walmart_recruiting.load()
      9 walmart_recruiting_df = get_repeatable_train_val_test_split(walmart_df, 'TripType', random_seed=42)
     10 

3 frames
[/usr/local/lib/python3.10/dist-packages/ludwig/datasets/loaders/dataset_loader.py](https://localhost:8080/#) in _sha256_digest(file_path)
     79     buffer = bytearray(hash.block_size * 1024)  # Attempts to read in multiples of the hash block size (64KB).
     80     mv = memoryview(buffer)
---> 81     with open(file_path, "rb", buffering=0) as f:
     82         for bytes_read in iter(lambda: f.readinto(mv), 0):
     83             hash.update(mv[:bytes_read])

FileNotFoundError: [Errno 2] No such file or directory: '/root/.ludwig_cache/walmart_recruiting_1.0/raw/walmart-recruiting-trip-type-classification.zip'
justinxzhao commented 1 year ago

Hi @andysingal,

In order to use datasets hosted on kaggle, you'll need to make sure that your Kaggle credentials are set up properly and you've logged into kaggle to agree to the rules of the competition: https://ludwig.ai/latest/user_guide/datasets/dataset_zoo/#kaggle-datasets

andysingal commented 1 year ago

Hi @andysingal,

In order to use datasets hosted on kaggle, you'll need to make sure that your Kaggle credentials are set up properly and you've logged into kaggle to agree to the rules of the competition: https://ludwig.ai/latest/user_guide/datasets/dataset_zoo/#kaggle-datasets

Thanks for your response , but i am still having challenges with datasets provided by your product as mentioned in the initial comments

justinxzhao commented 1 year ago

@andysingal The error in your previous comment is:

OSError: Could not find kaggle.json. Make sure it's located in /root/.kaggle. Or use the environment method.

Even though you are using Ludwig, the dataset itself is hosted by Kaggle, so you'll need to ensure you have the right kaggle credentials set up in order to load the dataset through Ludwig.

Does this file exist in your development environment?

ls ~HOME/.kaggle/kaggle.json
andysingal commented 1 year ago

File "/usr/local/lib/python3.10/dist-packages/ludwig/datasets/kaggle.py", line 10, in create_kaggle_client from kaggle import api File "/usr/local/lib/python3.10/dist-packages/kaggle/init.py", line 23, in

let me check, i am pretty sure i added it.. Let me add it again and share update to you . Thanks

SarthakNikhal commented 12 months ago

Can I help in resolving this issue?

iulianastroiavlad commented 11 months ago

Hi, is this issue solved? I tried the example from here: https://ludwig.ai/latest/getting_started/hyperopt/, to test the hyperopt (using ray version 2.3.1), but still I get the same initial error: ImportError: cannot import name 'Checkpoint' from 'ray.air'

SarthakNikhal commented 11 months ago

@andysingal Did you have the json file? Let me know if it worked

andysingal commented 11 months ago

I do, but still have to try it out . I added your ai software in my article : https://medium.com/illuminations-mirror/mlops-leveraging-large-language-models-for-streamlining-machine-learning-from-development-to-4023e08846bf

On Wed, Nov 29, 2023 at 01:13 Sarthak Nikhal @.***> wrote:

@andysingal https://github.com/andysingal Did you have the json file? Let me know if it worked

— Reply to this email directly, view it on GitHub https://github.com/ludwig-ai/ludwig/issues/3765#issuecomment-1831283117, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4LJNOSPYRZH7GT57Q7U6LYG3HADAVCNFSM6AAAAAA65C3MIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZRGI4DGMJRG4 . You are receiving this because you were mentioned.Message ID: @.***>

majsterkovic commented 5 months ago

I am encountering the same problem with the ray module and Checkpoint