llmware-ai / llmware-ai/llmware

Issue with Loading a SLIM Model from a local directory

Open
#939 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
14.8k
Forks
2.9k
PR merge metrics
No merged PRs in 30d

Description

I am experiencing an issue when attempting to load the `slim-sentiment-tool` model using the `load_model` method in the `ModelCatalog` class. The method raises a `ModelNotFoundException`, indicating that it cannot identify the model card for the selected model.

#### Steps to Reproduce
1. Download the model files and place them in the directory `/models/llmware/slim-sentiment-tool`.
```python
from llmware.models import pull_model_from_hf, ModelCatalog
model_card = ModelCatalog().lookup_model_card("slim-sentiment-tool")
pull_model_from_hf(model_card, "/models/llmware/slim-sentiment-tool")
```
2. Attempt to load the model using the following code:
```python
from llmware.models import ModelCatalog

def analyse_sentiment(text):
slim_model = ModelCatalog().load_model("/models/llmware/slim-sentiment-tool")
response = slim_model.function_call(text, get_logits=True)
analysis = ModelCatalog().logit_analysis(response, slim_model.model_card, slim_model.hf_tokenizer_name)
llm_response = response['llm_response']
confidence_score = float(analysis['confidence_score'])
return llm_response, confidence_score

text = "I am happy"
llm_response, confidence_score = analyse_sentiment(text)
```
3. Observe the following error:
```
ModelNotFoundException: '/models/llmware/slim-sentiment-tool' could not be located
```

#### Expected Behavior
The `load_model` method should correctly identify and load the model card for the `slim-sentiment-tool` model.

#### Actual Behavior
The method raises a `ModelNotFoundException`, indicating that it cannot identify the model card for the selected model.

#### Environment
- llmware version: 0.3.3
- Python version: 3.11

#### Request for Assistance
Could you please assist in identifying why the `load_model` method is unable to find the model card from the local path and suggest any necessary changes to fix this issue?

Thank you!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at ModelCatalog.load_model and compare its local-path handling with the pull_model_from_hf and lookup_model_card calls shown in the report. Reproduce the ModelNotFoundException with the downloaded directory; done means load_model identifies the local model card and the sentiment function_call example completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
huggingface, python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.