Instructions to use AbdulElahGwaith/transformers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AbdulElahGwaith/transformers with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AbdulElahGwaith/transformers", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download docs/source/zh/main_classes/text_generation.md from AbdulElahGwaith/transformers: direct link, hf CLI and curl.
- Browser
- Download file 1.66 kB
-
https://huggingface.co/AbdulElahGwaith/transformers/resolve/main/docs/source/zh/main_classes/text_generation.md
- Command line
-
hf download hf://AbdulElahGwaith/transformers/docs/source/zh/main_classes/text_generation.md
-
curl -L -o text_generation.md https://huggingface.co/AbdulElahGwaith/transformers/resolve/main/docs/source/zh/main_classes/text_generation.md
1.66 kB
Generation
每个框架都在它们各自的 GenerationMixin 类中实现了文本生成的 generate 方法:
- PyTorch [
~generation.GenerationMixin.generate] 在 [~generation.GenerationMixin] 中实现。
无论您选择哪个框架,都可以使用 [~generation.GenerationConfig] 类实例对 generate 方法进行参数化。有关生成方法的控制参数的完整列表,请参阅此类。
要了解如何检查模型的生成配置、默认值是什么、如何临时更改参数以及如何创建和保存自定义生成配置,请参阅 文本生成策略指南。该指南还解释了如何使用相关功能,如token流。
GenerationConfig
[[autodoc]] generation.GenerationConfig - from_pretrained - from_model_config - save_pretrained
GenerationMixin
[[autodoc]] generation.GenerationMixin - generate - compute_transition_scores