Spaces:
Runtime error
Runtime error
Update src/app/model.py
Browse files- src/app/model.py +4 -4
src/app/model.py
CHANGED
@@ -18,7 +18,7 @@ load_dotenv()
|
|
18 |
access_token = os.environ.get("ACCESS_TOKEN")
|
19 |
|
20 |
|
21 |
-
def
|
22 |
"""
|
23 |
Load the model, tokenizer and processor.
|
24 |
|
@@ -49,13 +49,13 @@ def load_model_and_tokenizer(model_name: str, device: str) -> Any:
|
|
49 |
)
|
50 |
model.eval()
|
51 |
|
52 |
-
# Log the successful loading of the model and
|
53 |
-
logging.info("Model and
|
54 |
|
55 |
# Return the model, tokenizer and processor
|
56 |
return model, tokenizer, processor
|
57 |
|
58 |
-
# Handle exceptions that may occur during model and
|
59 |
except Exception as e:
|
60 |
# Custom exception handling
|
61 |
raise CustomExceptionHandling(e, sys) from e
|
|
|
18 |
access_token = os.environ.get("ACCESS_TOKEN")
|
19 |
|
20 |
|
21 |
+
def load_model_tokenizer_and_processor(model_name: str, device: str) -> Any:
|
22 |
"""
|
23 |
Load the model, tokenizer and processor.
|
24 |
|
|
|
49 |
)
|
50 |
model.eval()
|
51 |
|
52 |
+
# Log the successful loading of the model, tokenizer and processor
|
53 |
+
logging.info("Model, tokenizer and processor loaded successfully.")
|
54 |
|
55 |
# Return the model, tokenizer and processor
|
56 |
return model, tokenizer, processor
|
57 |
|
58 |
+
# Handle exceptions that may occur during model, tokenizer and processor loading
|
59 |
except Exception as e:
|
60 |
# Custom exception handling
|
61 |
raise CustomExceptionHandling(e, sys) from e
|