Skip to content

AttributeError: 'torch.device' object has no attribute 'split' #30

@ay2025gt

Description

@ay2025gt

When I enter the following code:
from trident.segmentation_models import segmentation_model_factory
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
segmentation_model = segmentation_model_factory("hest", device=device)
geojson_contours = slide.segment_tissue(segmentation_model=segmentation_model, job_dir=job_dir)

The result outputs:

slide = OpenSlideWSI(slide_path='/mnt/d/test_PDA/C3L-00277-23.svs', lazy_init=False)
segmentation_model = segmentation_model_factory("hest", device=device)
contours = slide.segmUsing cache found in /home/lf/.cache/torch/hub/pytorch_vision_v0.10.0
Fetching 1 files: 0%| | 0/1 [00:00<?, ?it/s]
deeplabv3_seg_v4.ckpt: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████
Fetching 1 files: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [
geojson_contours = slide.segment_tissue(segmentation_model=segmentation_model, job_dir=job_dir)
Traceback (most recent call last):
with torch.autocast(device_type=device.split(":")[0], dtype=precision, enabled=(precision != torch.float32)):
AttributeError: 'torch.device' object has no attribute 'split'

How should I resolve this? I would greatly appreciate your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions