saujasv commited on
Commit
2a73d1c
·
1 Parent(s): 3013d28

add logging to see if handler is being used

Browse files
Files changed (1) hide show
  1. handler.py +5 -1
handler.py CHANGED
@@ -4,6 +4,7 @@ from greenery.parse import NoMatch
4
  from listener import Listener, ListenerOutput
5
  import time
6
  import json
 
7
 
8
  class EndpointHandler:
9
  def __init__(self, path=""):
@@ -14,10 +15,13 @@ class EndpointHandler:
14
  "num_return_sequences": 500,
15
  "num_beams": 1
16
  }, device="cuda")
 
17
 
18
  def __call__(self, data):
19
  # get inputs
20
  inp = json.loads(data.pop("inputs", None))
 
 
21
  spec = inp["spec"]
22
  true_program = inp["true_program"]
23
 
@@ -34,4 +38,4 @@ class EndpointHandler:
34
  "top_1_score": sorted_programs[0][0],
35
  "top_5_success": any([parse(p).equivalent(parse(true_program)) for _, p in sorted_programs[:5]]),
36
  "time": end - start
37
- }
 
4
  from listener import Listener, ListenerOutput
5
  import time
6
  import json
7
+ import logging
8
 
9
  class EndpointHandler:
10
  def __init__(self, path=""):
 
15
  "num_return_sequences": 500,
16
  "num_beams": 1
17
  }, device="cuda")
18
+ logging.info("Loaded model with custom endpoint handler")
19
 
20
  def __call__(self, data):
21
  # get inputs
22
  inp = json.loads(data.pop("inputs", None))
23
+ logging.info(str(data))
24
+ logging.info(str(data["inputs"]))
25
  spec = inp["spec"]
26
  true_program = inp["true_program"]
27
 
 
38
  "top_1_score": sorted_programs[0][0],
39
  "top_5_success": any([parse(p).equivalent(parse(true_program)) for _, p in sorted_programs[:5]]),
40
  "time": end - start
41
+ }