curated transformers
v2.0.1:

最先進的變壓器,磚塊
策劃的變壓器是Pytorch的變壓器庫。它提供了由一組可重複使用的組件組成的最新模型。策展變壓器的出色特徵是:
bitsandbytes庫支持4/8位推斷,並且每個模型都可以使用Pytorch meta設備來避免不必要的分配和初始化。策劃的變壓器已通過爆炸進行了測試,並將用作Spacy 3.7中的默認變壓器實現。
支持的僅編碼模型:
僅支持解碼器的模型:
發電機包裝器:
所有類型的型號都可以從HuggingFace Hub加載。
策劃變壓器的Spacy集成由spacy-curated-transformers軟件包提供。
pip install curated-transformersPytorch的默認Linux構建是由CUDA 11.7支持構建的。您應該在以下情況下明確安裝CUDA構建:
在這兩種情況下,您都可以使用以下方式安裝pytorch
pip install torch --index-url https://download.pytorch.org/whl/cu118>>> import torch
>>> from curated_transformers.generation import AutoGenerator, GreedyGeneratorConfig
>>> generator = AutoGenerator.from_hf_hub( name = " tiiuae/falcon-7b-instruct " , device = torch.device( " cuda " ))
>>> generator([ " What is Python in one sentence? " , " What is Rust in one sentence? " ], GreedyGeneratorConfig())
['Python is a high-level programming language that is easy to learn and widely used for web development, data analysis, and automation.',
'Rust is a programming language that is designed to be a safe, concurrent, and efficient replacement for C++.']您可以在文檔中找到更多用法示例。您還可以在examples目錄中找到使用策劃的變壓器的示例程序。
您可以在此處閱讀有關如何使用策劃變壓器的更多信息:
curated-transformers通過利用bitsandbytes庫來支持模型的動態8位和4位量化。
使用量化變體自動安裝必要的依賴項:
pip install curated-transformers[quantization]