基于pipeline的translation_xx_to_yy任务,其translation_xx_to_yy模式为 xx 是源语言代码,yy 是目标语言代码,pipeline的默认模型是t5-base: 代码语言:javascript 复制 importos os.environ["HF_ENDPOINT"]="https://hf-mirror.com"os.environ["CUDA_VISIBLE_DEVICES"]="2"from transformersimportpipeline en_fr_...
translator = pipeline('translation_en_to_fr') # 进行翻译 result = translator("Hugging Face is a technology company based in New York and Paris", max_length=40) print(result[0]['translation_text']) 上述代码将英文文本翻译成法文,并输出翻译结果。 实际应用与建议 1. 实际应用场景 社交媒体分析:...
translation_token_ids:一个张量,包含译文的 token id。仅当 return_tensors=True 时生效。 示例: en_fr_translator = pipeline("translation_en_to_fr") en_fr_translator("How old are you?")class transformers.ZeroShotClassificationPipeline(*args, **kwargs):使用在 natural language inference: NLI 任务...
使用场景:通过指定语言对 (形如 translation_en_to_fr) 使用默认模型或使用来自 ModelHub 的模型。 使用样例: from transformers import pipeline translator = pipeline("translation", model="Helsinki-NLP/opus-mt-fr-en") translator("Ce cours est produit par Hugging Face.") # output: [{'translation_te...
"translation":将返回一个TranslationPipeline。 "translation_xx_to_yy":将返回一个TranslationPipeline。 "video-classification":将返回一个VideoClassificationPipeline。 "visual-question-answering":将返回一个VisualQuestionAnsweringPipeline。 "zero-shot-classification":将返回一个ZeroShotClassificationPipeline。
"translation_xx_to_yy":将返回一个TranslationPipeline。 "video-classification":将返回一个VideoClassificationPipeline。 "visual-question-answering":将返回一个VisualQuestionAnsweringPipeline。 "zero-shot-classification":将返回一个ZeroShotClassificationPipeline。
Modify the scripts according to the number of languages you have. Then, use the following code: CUDA_VISIBLE_DEVICES=2 nohup python 7-note-translation-bilingual.py "BE" > logs/BE/translate_notes_final.md & Corpora with more than one language: Parlamint-BE (Belgian), which has nl + fr....
Présentation des connecteurs personnalisés
path: ./docs/locale/en/* if-no-files-found: error deploy: if: github.event_name != 'workflow_dispatch' || inputs.do_deployment name: Deploy to qiskit.org needs: [build] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: path: qiskit - uses: actions/download-artifact...
Improved Japanese translation (langgenius#4119) May 7, 2024 README_KL.md Update EN,KL,JA,FR,ES documentation Llma2 to Llama3 model support (la… Apr 25, 2024 Repository files navigation README Code of conduct License Dify Cloud· Self-hosting· Documentation· Enterprise inquiry Dify is ...