While getting the fairchem models up and running in a modal app, I wanted to do something like this:
import modal
app = modal.App()
app.image = ...
# no decorator here so we don't publish a _BaseModel entrypoint
class _BaseModel():
@modal.enter()
def load_model(self):
# common logic to load model checkpoints
...
@modal.method()
def run_inference(self):
# common logic for inference
...
@app.cls(...)
class MyModel(_BaseModel):
# modal picks up the load_model and run_inference methods from the base class
...
@app.cls(...)
class MyOtherModel(_BaseModel):
...
Modal accepts this kind of setup and handles associating the methods with the subclasses, but our current parsing for modal functions does not recognize the run_inference method as a member of the subclasses.
The backend should recognize two modal classes here, MyModel and MyOtherModel each with a run_inference method as the entrypoint. Currently, the backend recognizes the two model classes, but does not find the run_inference method and returns an empty list of modal functions for each model.
While getting the fairchem models up and running in a modal app, I wanted to do something like this:
Modal accepts this kind of setup and handles associating the methods with the subclasses, but our current parsing for modal functions does not recognize the
run_inferencemethod as a member of the subclasses.The backend should recognize two modal classes here,
MyModelandMyOtherModeleach with arun_inferencemethod as the entrypoint. Currently, the backend recognizes the two model classes, but does not find therun_inferencemethod and returns an empty list of modal functions for each model.