model = init_model(config_file, checkpoint_file, device=device)
sample images
fake_imgs = sample_unconditional_model(model, 4)
Reproduces the problem - command or script
执行此文件报错:
python 1.py
Reproduces the problem - error message
Traceback (most recent call last):
File "1.py", line 1, in
from mmgen.apis import init_model, sample_unconditional_model
File "/home/keshawn/mmgen/mmgeneration/mmgen/init.py", line 21, in
mmcv_version = digit_version(mmcv.version)
AttributeError: module 'mmcv' has no attribute 'version'
Prerequisite
Task
I'm using the official example scripts/configs for the officially supported tasks/models/datasets.
Environment
当前环境
NVIDIA Driver Version: 510.47.03
CUDA Version: 11.6 torch 1.13.1+cu116 torchvision 0.14.1+cu116 mmcv-full 1.7.1 openmim 0.3.9 mmgen 0.7.3 /home/keshawn/mmgen/mmgeneration
Reproduces the problem - code sample
from mmgen.apis import init_model, sample_unconditional_model
config_file = 'configs/styleganv2/stylegan2_c2_lsun-church_256_b4x8_800k.py'
you can download this checkpoint in advance and use a local file path.
checkpoint_file = 'https://download.openmmlab.com/mmgen/stylegan2/official_weights/stylegan2-church-config-f-official_20 210327_172657-1d42b7d1.pth' device = 'cuda:0'
init a generatvie
model = init_model(config_file, checkpoint_file, device=device)
sample images
fake_imgs = sample_unconditional_model(model, 4)
Reproduces the problem - command or script
执行此文件报错:
python 1.py
Reproduces the problem - error message
Traceback (most recent call last): File "1.py", line 1, in
from mmgen.apis import init_model, sample_unconditional_model
File "/home/keshawn/mmgen/mmgeneration/mmgen/init.py", line 21, in
mmcv_version = digit_version(mmcv.version)
AttributeError: module 'mmcv' has no attribute 'version'
Additional information
如果同时安装 mmcv 和 mmcv-full 也一样会报错