Skip to content

Commit

Permalink
Fix lightning import for building docs (#358)
Browse files Browse the repository at this point in the history
* Fix lightning import for building docs

* Update copyright
  • Loading branch information
zhiqwang authored Mar 12, 2022
1 parent 5d820db commit 825d885
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 5 additions & 4 deletions yolort/data/coco_eval.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) 2021, Zhiqiang Wang. All Rights Reserved.
# Copyright (c) 2021, yolort team. All rights reserved.

import contextlib
import copy
import io
Expand All @@ -8,16 +9,16 @@

import numpy as np
from tabulate import tabulate
from torchmetrics import Metric
from torchvision.ops import box_convert

try:
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
from torchmetrics import Metric
except ImportError:
COCO, COCOeval = None, None
COCO, COCOeval, Metric = None, None, None

from typing import List, Any, Callable, Optional, Union
from typing import Any, List, Callable, Optional, Union

from ._helper import create_small_table
from .distributed import all_gather
Expand Down
9 changes: 7 additions & 2 deletions yolort/data/data_module.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Copyright (c) 2021, Zhiqiang Wang. All Rights Reserved.
# Copyright (c) 2021, yolort team. All rights reserved.

from pathlib import Path
from typing import Callable, List, Any, Optional

import torch.utils.data
from pytorch_lightning import LightningDataModule
from torch.utils.data.dataset import Dataset

try:
from pytorch_lightning import LightningDataModule
except ImportError:
LightningDataModule = None

from .coco import COCODetection
from .transforms import collate_fn, default_train_transforms, default_val_transforms
from .voc import VOCDetection
Expand Down

0 comments on commit 825d885

Please sign in to comment.