sentenceaugmentationmapper

February 4, 2026 · View on GitHub

Augments sentences by generating enhanced versions using a Hugging Face model. This operator enhances input sentences by generating new, augmented versions. It is designed to work best with individual sentences rather than full documents. For optimal results, ensure the input text is at the sentence level. The augmentation process uses a Hugging Face model, such as lmsys/vicuna-13b-v1.5 or Qwen/Qwen2-7B-Instruct. The operator requires specifying both the primary and secondary text keys, where the augmented sentence will be stored in the secondary key. The generation process can be customized with parameters like temperature, top-p sampling, and beam search size.

使用 Hugging Face 模型生成增强版本的句子以进行数据增强。该算子通过生成新的增强版本来增强输入句子。它设计为最适合处理单个句子而不是整个文档。为了获得最佳结果,请确保输入文本处于句子级别。增强过程使用 Hugging Face 模型,如 lmsys/vicuna-13b-v1.5Qwen/Qwen2-7B-Instruct。算子要求指定主次文本键,其中增强后的句子将存储在次级键中。生成过程可以通过温度、top-p 采样和束搜索大小等参数进行自定义。

Type 算子类型: mapper

Tags 标签: gpu, hf, text

🔧 Parameter Configuration 参数配置

name 参数名type 类型default 默认值desc 说明
hf_model<class 'str'>'Qwen/Qwen2-7B-Instruct'Huggingface model id.
system_prompt<class 'str'>NoneSystem prompt.
task_sentence<class 'str'>NoneThe instruction for the current task.
max_new_tokens256the maximum number of new tokens generated by the model.
temperature0.2used to control the randomness of generated text. The higher the temperature, the more random and creative the generated text will be.
top_pNonerandomly select the next word from the group of words whose cumulative probability reaches p.
num_beams1the larger the beam search size, the higher the quality of the generated text.
text_keyNonethe key name used to store the first sentence in the text pair. (optional, defalut='text')
text_key_secondNonethe key name used to store the second sentence in the text pair.
args''extra args
kwargs''extra args