我正在构建我的第一个
config.yml
文件,但我收到有关 config.yml
格式的错误。
如何解决这个问题?
我想我收到了有关 YML 文件绑定格式的错误。
但我无法修复它。
我的
config.yml
文件:
WORKFLOW:
EXTRACT_SUMMARIZATION:
PROMPT_SUMMARY: """Extracting the timestamps of the goals scored by players in a football match using the commentator's description.\n
The structure of input is:
timestamp => text
timestamp => text
timestamp => text
timestamp => text
The output only consists of timestamps and does not include any text.
Example:
Input:
0:01 => [Applause]
0:04 => Welcome, ladies and gentlemen, to the match between Liverpool and Chelsea.
0:14 => Silva has scored, and the score is 1-0 in favor of Liverpool.
0:20 => So, there has been a foul committed by a Liverpool player.
0:25 => The referee has blown the whistle to end the first half.
0:30 => Chelsea has equalized through Ch.
0:45 => Tr has put Chelsea in the lead.
0:50 => So, the match has...
0:55 => ended, and the victory goes to Chelsea.
Output: 0:14, 0:30, 0:45
This is a incorrect format of output:
0:14 => Silva has scored, and the score is 1-0 in favor of Liverpool.
0:45 => Tr has put Chelsea in the lead.
This is an another incorrect format of output:
0:01 => [Applause]
0:04 => 0:14 => 0:25 =>
Do it for the following text:
Input:
{}
Output:
"""
SCALE_TIME_BEFORE: 6
SCALE_TIME_AFTER: 58
ABSTRACT_SUMMARIZATION:
PROMPT: "Rewrite the following sentences to form a paragraph: {}"
COMBINE_CLIP:
SPEECH_RATE: 130
SUB_VIDEO:
FORCE_DOWNLOAD: True
USE_IMAGEIO: False
我使用了yaml验证器
如果您开始使用 YAML,请遵循官方推荐的包含 YAML 文档的文件扩展名:
.yaml
,多年来一直如此。
您还应该对用于 YAML 解析的在线工具感到厌倦,它们通常会给出有关 YAML 文档有效性的错误反馈,因为有些工具使用过时和/或不完整的解析器。您还应该考虑上传数据的机密性。
如果您使用我的
ruamel.yaml
解析器加载文档,您会收到此错误:
ruamel.yaml.parser.ParserError: while parsing a block mapping
in "<unicode string>", line 3, column 5:
PROMPT_SUMMARY: """Extracting th ...
^ (line: 3)
expected <block end>, but found '<scalar>'
in "<unicode string>", line 3, column 23:
PROMPT_SUMMARY: """Extracting the timestamps of th ...
^ (line: 3)
发生的情况是,您尝试在空标量字符串
"Extracting the....
(键 ""
的值)之后直接启动一个标量 (PROMPT_SUMMARY
)。 YAML 不允许两个双引号通过 justaposition 连接,或者您可能将 YAML 带引号的标量与 Python 三引号字符串混淆了。
您应该在标量末尾使用一个双引号。这些可用于多行字符串,但请注意,此类字符串中的换行符不会保留,每个换行符都必须是 。如果您需要保留换行符,请使用文字样式标量:
PROMPT_SUMMARY: |
Extracting the timestamps of the goals scored by players in a football match using the commentator's description.\n
The structure of input is:
timestamp => text
timestamp => text
timestamp => text
timestamp => text
The output only consists of timestamps and does not include any text.
Example:
Input:
0:01 => [Applause]
0:04 => Welcome, ladies and gentlemen, to the match between Liverpool and Chelsea.
0:14 => Silva has scored, and the score is 1-0 in favor of Liverpool.
0:20 => So, there has been a foul committed by a Liverpool player.
0:25 => The referee has blown the whistle to end the first half.
0:30 => Chelsea has equalized through Ch.
0:45 => Tr has put Chelsea in the lead.
0:50 => So, the match has...
0:55 => ended, and the victory goes to Chelsea.
Output: 0:14, 0:30, 0:45
This is a incorrect format of output:
0:14 => Silva has scored, and the score is 1-0 in favor of Liverpool.
0:45 => Tr has put Chelsea in the lead.
This is an another incorrect format of output:
0:01 => [Applause]
0:04 => 0:14 => 0:25 =>
Do it for the following text:
Input:
{}
Output:
但在字面样式标量中,没有转义(因此
\n
将是反斜杠,后跟 n
)。
如果多个双引号需要成为值的一部分,那么您可以将它们添加到文字标量中,没有问题