Merge pull request #88 from stanford-oval/wip/no_grad
add torch.no_grad to kfserver
This commit is contained in:
commit
ca293b8814
|
@ -64,6 +64,7 @@ class Server:
|
|||
return NumericalizedExamples.collate_batches(all_features, self.numericalizer, device=self.device)
|
||||
|
||||
def handle_request(self, line):
|
||||
with torch.no_grad():
|
||||
if isinstance(line, dict):
|
||||
request = line
|
||||
else:
|
||||
|
@ -169,7 +170,6 @@ class Server:
|
|||
self.model.to(self.device)
|
||||
|
||||
self.model.eval()
|
||||
with torch.no_grad():
|
||||
if self.args.stdin:
|
||||
self._run_stdin()
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue