Python-多行命令的语法无效

问题描述 投票:-3回答:1

很抱歉,如果这确实很基本。我正在尝试在最近的两分钟论文视频(https://www.youtube.com/watch?v=mUfJOQKdtAk)中使用很酷的新DeepFake代码,并且他们的其中一行代码遇到语法错误。下面的最小工作示例:

from modules.generator import OcclusionAwareGenerator

def load_checkpoints(config_path, checkpoint_path):

    with open(config_path) as f:
        config = yaml.load(f)

    generator = OcclusionAwareGenerator(**config['model_params']['generator_params'],
                                        **config['model_params']['common_params'])
    generator.cuda()

它在“ generator =”行末尾的逗号中给出语法错误。

generator = OcclusionAwareGenerator(**config['model_params']['generator_params'],
                                                                                ^
SyntaxError: invalid syntax

我习惯于使用python 2,所以我首先想到的是那是python 3,但是老实说我不知道​​。如果有人知道为什么这是无效的,我会全神贯注。谢谢!

python syntax
1个回答
0
投票
它似乎与python3.7一起使用我通过requirements.txt文件安装了其他一些依赖项。pip3 install -r requirements.txt

它也需要cuda,我没有,所以很遗憾,它无法在笔记本电脑上成功运行。

© www.soinside.com 2019 - 2024. All rights reserved.