Skip to content

Commit

Permalink
process per batch model(batch)
Browse files Browse the repository at this point in the history
  • Loading branch information
amva13 committed Oct 26, 2024
1 parent 32650e6 commit 05f9e9f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tdc/test/test_model_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,13 @@ def testGeneformerTokenizer(self):

input_tensor = torch.tensor(cells)
# input_tensor = torch.squeeze(input_tensor)
out = []
try:
# input_tensor.squeeze(2) # last dim is zero
out = model(input_tensor)
for batch in input_tensor:
out.append(model(batch))
except Exception as e:
raise Exception("tensor shape is", input_tensor.shape, "exception was:", e, "\n cells was\n", cells)
# raise Exception(e)

# input_tensor = torch.tensor(cells)
# input_tensor_squeezed = torch.squeeze(input_tensor)
# x = input_tensor_squeezed.shape[0]
Expand All @@ -147,8 +148,8 @@ def testGeneformerTokenizer(self):
# except Exception as e:
# raise Exception("tensor shape is", input_tensor.shape, "exception was: {}".format(e), "input_tensor_squeezed is\n", input_tensor, "\n\ninput_tensor normal is: {}".format(input_tensor))
assert out, "FAILURE: Geneformer output is false-like. Value = {}".format(out)
assert out.shape[0] == input_tensor.shape[0], "FAILURE: Geneformer output and input tensor input don't have the same length. {} vs {}".format(out.shape[0], input_tensor.shape[0])
assert out.shape[0] == len(cells), "FAILURE: Geneformer output and tokenized cells don't have the same length. {} vs {}".format(out.shape[0], len(cells))
assert len(out) == input_tensor.shape[0], "FAILURE: Geneformer output and input tensor input don't have the same length. {} vs {}".format(len(out), input_tensor.shape[0])
assert len(out) == len(cells), "FAILURE: Geneformer output and tokenized cells don't have the same length. {} vs {}".format(len(out), len(cells))

def tearDown(self):
try:
Expand Down

0 comments on commit 05f9e9f

Please sign in to comment.