Skip to content

Commit

Permalink
Merge pull request #18 from jinmang2/main
Browse files Browse the repository at this point in the history
fix cuda device error for tableformer/unitable
  • Loading branch information
Filimoa authored Apr 11, 2024
2 parents e466e8b + 4ff4688 commit 256bd5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/openparse/tables/table_transformers/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def _table_outputs_to_objs(
def find_table_bboxes(
image: Image.Image, min_table_confidence: float
) -> List[_TableModelOutput]:
pixel_values = detection_transform(image).unsqueeze(0).to("cpu")
pixel_values = detection_transform(image).unsqueeze(0).to(device)
with torch.no_grad():
outputs = detection_model(pixel_values)

Expand Down Expand Up @@ -334,7 +334,7 @@ def get_table_content(
len(structure_model.config.id2label): "no object",
}

pixel_values_st = structure_transform(table_img).unsqueeze(0).to("cpu")
pixel_values_st = structure_transform(table_img).unsqueeze(0).to(device)
with torch.no_grad():
outputs_st = structure_model(pixel_values_st)

Expand Down

0 comments on commit 256bd5e

Please sign in to comment.