Skip to content

The TextGeneration ModuleBases raises exception when loading weights from a path #248

@VassilisVassiliadis

Description

@VassilisVassiliadis

Describe the bug

When using artifact_path to load weights from a path with one of the text_generation ModuleBases the caikit runtime emits the following error:

{"channel": "LLOAD", "exception": null, "level": "warning", "log_code": "<COR98539580W>", "message": "DEPRECATION: Loading f9181353-4ccf-4572-bd1e-f12bcda26792 failed with ModuleConfig. Using model_path. expected str, bytes or os.PathLike object, not ModuleConfig", "num_indent": 0, "thread_id": 140699291752000, "timestamp": "2023-10-27T11:21:44.284465"}

The source of the exception is os.path.join in

base_model_path = os.path.join(model_path, base_model_path)

model_path is a ModuleConfig object instead of a str.

Platform

Please provide details about the environment you are using, including the following:

  • Interpreter version: 3.11.5
  • Library version: 0.22.0

Sample Code

Create the files /tmp/test/runtime_config.yml and /tmp/test/local_models_dir/text_generation/config.yml like so:

File /tmp/test/runtime_config.yml

runtime:
  local_models_dir: /tmp/test/local_models_dir/
  library: caikit_nlp

File /tmp/test/local_models_dir/text_generation/config.yml

module_id: f9181353-4ccf-4572-bd1e-f12bcda26792
artifact_path: /tmp/test/google-flan-t5-base

Download the weights of https://huggingface.co/google/flan-t5-base under /tmp/test/google-flan-t5-base

Then run:

export CONFIG_FILES=/tmp/test/runtime_config.yml
python3 -m caikit.runtime

Expected behavior

The TextGeneration ModuleBase in text_generation_local.py should successfully load the weights.

Observed behavior

The LocalModelManager is unable to trigger the loading of the weights using the TextGeneration ModuleBase. The terminal shows the following message:

{"channel": "LLOAD", "exception": null, "level": "warning", "log_code": "<COR98539580W>", "message": "DEPRECATION: Loading f9181353-4ccf-4572-bd1e-f12bcda26792 failed with ModuleConfig. Using model_path. expected str, bytes or os.PathLike object, not ModuleConfig", "num_indent": 0, "thread_id": 140699291752000, "timestamp": "2023-10-27T11:21:44.284465"}

Additional context

I think the fix is to expect a Union[str, ModuleConfig] for the model_path argument of the ModuleBase.load() methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions