question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python backend bug when using model load api to reload model in explicit mode

See original GitHub issue

Description I have a found a bug when using the model load api to re-load an already loaded python backend model in explicit mode. To explain the scenario, We have a model which is already being loaded and running by Triton. We have a new version of the model which we would like Triton to load. So when triton is currently running and serving the model, we deleted the same model from model repository and copied the new version of the model. If we call the load API /v2/repository/models/<model_name>/load it will start re-loading the model. The bug here is that triton is not using the conda environment of the new version of the model. it continues to use the conda environment of old model hence resulting is failed model re-load in case there are newer dependencies in the conda environment for newer version.

Triton Information What version of Triton are you using? r22.07

Are you using the Triton container or did you build it yourself? Triton Container

To Reproduce Steps to reproduce the behavior. Its easy to reproduce the issue, create two versions of same python backend model. one with an additional python dependency i.e both versions just only differ in conda environments (provided example model.py and requirements.txt below for each version). use triton to load one version of the model and when triton is successfully loaded the model and running, remove the model from model repository and copy the other version which has an additonal dependency and call the model reload api. it will fail saying module not found error(for example, in the below case it will fail to re-load with pandas module not found error).

Version 1 - model.py

import triton_python_backend_utils as pb_utils
 
import numpy as np
 
 class TritonPythonModel:
    def initialize(self, args):
    	pass
    def execute(self, requests):
    	pass
    def finalize(self):
        pass

version 1 - requirements.txt

numpy

Version 2 - model.py

import triton_python_backend_utils as pb_utils
 
import numpy as np
import pandas as pd
 
 class TritonPythonModel:
    def initialize(self, args):
    	pass
    def execute(self, requests):
    	pass
    def finalize(self):
        pass

version 2 - requirements.txt

numpy
pandas

Describe the models (framework, inputs, outputs), ideally include the model configuration file (if using an ensemble include the model configuration file for that as well). python backend

Expected behavior A clear and concise description of what you expected to happen. when reloading an model it should reload conda environment too

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
SaratM34commented, Dec 14, 2022

Hi @dyastremsky Thanks so much for the update.

1reaction
dyastremskycommented, Sep 1, 2022

Thanks for checking in. No update yet. When there is an update and/or corresponding pull request, this GitHub issue should be updated as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Save and Load Machine Learning Models in Python with scikit ...
Save Your Model with pickle​​ Pickle is the standard way of serializing objects in Python. You can use the pickle operation to serialize...
Read more >
Django model "doesn't declare an explicit app_label"
I'm using Python 3.4 and Django 1.10. From my settings.py: INSTALLED_APPS = [ 'DeleteNote.apps.DeletenoteConfig', 'LibrarySync.apps.LibrarysyncConfig' ...
Read more >
API — ONNX Runtime 1.14.0 documentation
It is used to load and run an ONNX model, as well as specify environment and application configuration options. session = onnxruntime.
Read more >
Models - Django documentation
Each model is a Python class that subclasses django.db.models.Model . ... Be careful not to choose field names that conflict with the models...
Read more >
Changelog — Python 3.11.1 documentation
gh-96055: Update faulthandler to emit an error message with the proper ... bpo-45840: Improve cross-references in the documentation for the data model.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found