WinstonShum
commited on
Commit
•
3361970
1
Parent(s):
b1145b7
Update handler.py
Browse files- handler.py +4 -0
handler.py
CHANGED
@@ -22,6 +22,10 @@ class EndpointHandler:
|
|
22 |
)
|
23 |
self.tokenizer = AutoTokenizer.from_pretrained(path)
|
24 |
logger.info("Model and tokenizer loaded sucessfully")
|
|
|
|
|
|
|
|
|
25 |
|
26 |
# Define the prompt template
|
27 |
self.prompt_template = """You are an assistant designed to identify whether a user query is malicious.
|
|
|
22 |
)
|
23 |
self.tokenizer = AutoTokenizer.from_pretrained(path)
|
24 |
logger.info("Model and tokenizer loaded sucessfully")
|
25 |
+
gpu_memory_allocated = torch.cuda.memory_allocated() / 1024**3 # Convert to GB
|
26 |
+
gpu_memory_reserved = torch.cuda.memory_reserved() / 1024**3 # Convert to GB
|
27 |
+
logger.info(f"GPU memory allocated after model loading: {gpu_memory_allocated:.2f} GB")
|
28 |
+
logger.info(f"GPU memory reserved after model loading: {gpu_memory_reserved:.2f} GB")
|
29 |
|
30 |
# Define the prompt template
|
31 |
self.prompt_template = """You are an assistant designed to identify whether a user query is malicious.
|