Skip to content

Commit 336435b

Browse files
authored
[Fix] Fix colab mmcv installation (open-mmlab#1779)
* fix mmcv installation * add torch version and mmcv version * fix typo
1 parent 0e37281 commit 336435b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

demo/MMSegmentation_Tutorial.ipynb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@
6767
"outputs": [],
6868
"source": [
6969
"# Install PyTorch\n",
70-
"!conda install pytorch=1.10.0 torchvision cudatoolkit=11.1 -c pytorch\n",
70+
"!pip install torch==1.12.0 torchvision --extra-index-url https://download.pytorch.org/whl/cu113\n",
7171
"# Install MMCV\n",
72-
"!pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.10/index.html"
72+
"!pip install openmim\n",
73+
"!mim install mmcv-full==1.6.0"
7374
]
7475
},
7576
{
@@ -439,6 +440,7 @@
439440
"outputs": [],
440441
"source": [
441442
"from mmseg.apis import set_random_seed\n",
443+
"from mmseg.utils import get_device\n",
442444
"\n",
443445
"# Since we use only one GPU, BN is used instead of SyncBN\n",
444446
"cfg.norm_cfg = dict(type='BN', requires_grad=True)\n",
@@ -526,6 +528,7 @@
526528
"cfg.seed = 0\n",
527529
"set_random_seed(0, deterministic=False)\n",
528530
"cfg.gpu_ids = range(1)\n",
531+
"cfg.device = get_device()\n",
529532
"\n",
530533
"# Let's have a look at the final config used for training\n",
531534
"print(f'Config:\\n{cfg.pretty_text}')"
@@ -618,7 +621,7 @@
618621
"provenance": []
619622
},
620623
"kernelspec": {
621-
"display_name": "Python 3",
624+
"display_name": "Python 3.10.4 ('colab')",
622625
"language": "python",
623626
"name": "python3"
624627
},
@@ -632,7 +635,7 @@
632635
"name": "python",
633636
"nbconvert_exporter": "python",
634637
"pygments_lexer": "ipython3",
635-
"version": "3.7.0"
638+
"version": "3.10.4"
636639
},
637640
"pycharm": {
638641
"stem_cell": {
@@ -642,6 +645,11 @@
642645
},
643646
"source": []
644647
}
648+
},
649+
"vscode": {
650+
"interpreter": {
651+
"hash": "407d2a53ddc3f8f7c4edd35e4d9b95b1c1ccdf5b3711df67dd21487022baf36e"
652+
}
645653
}
646654
},
647655
"nbformat": 4,

0 commit comments

Comments
 (0)