Tủ GitHub repo xịn
Avatar huggingface

GitHub repo xịn · Vui Coding chọn

huggingface/transformers

Huggingface/transformers là thư viện mã nguồn mở cung cấp các mô hình pretrained cho xử lý ngôn ngữ tự nhiên, thị giác, âm thanh và đa phương tiện, hỗ trợ inference và training. Nó giúp đơn giản hóa việc sử dụng, tùy chỉnh và triển khai các mô hình trạng thái nghệ thuật trong nhiều lĩnh vực AI.

165,6 NGitHub stars
34,6 NForks
2,4 NOpen issues
2Lượt nhấp GitHub
PythonNgôn ngữ chính

Tóm tắt nhanh

Repo này làm được gì?

Huggingface/transformers là thư viện mã nguồn mở cung cấp các mô hình pretrained cho xử lý ngôn ngữ tự nhiên, thị giác, âm thanh và đa phương tiện, hỗ trợ inference và training. Nó giúp đơn giản hóa việc sử dụng, tùy chỉnh và triển khai các mô hình trạng thái nghệ thuật trong nhiều lĩnh vực AI.

Mô tả từ GitHub

🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.

Bắt đầu với repo

Cài đặt và sử dụng

Hướng dẫn cài đặt

Tạo môi trường ảo: - venv:

python -m venv .my-env
source .my-env/bin/activate

- uv:

uv venv .my-env
source .my-env/bin/activate

Cài đặt thư viện:

pip install "transformers[torch]"

hoặc

uv pip install "transformers[torch]"

. Nếu muốn cài từ source:

git clone https://github.com/huggingface/transformers.git
cd transformers
pip install '.[torch]'

hoặc

uv pip install '.[torch]'

.

Hướng dẫn sử dụng

Sử dụng cơ bản: - Nhập thư viện:

from transformers import pipeline

- Khởi tạo pipeline:

pipeline = pipeline(task="text-generation", model="Qwen/Qwen2.5-1.5B")

- Gửi prompt:

pipeline("the secret to baking a really good cake is ")

- Kết quả: {'generated_text': 'the secret to baking a really good cake is 1) to use ...'} Ví dụ chat hệ thống:

pipeline = pipeline(task="text-generation", model="meta-llama/Meta-Llama-3-8B-Instruct")
response = pipeline(chat, max_new_tokens=512)
print(response[0]['generated_text'])
Đối chiếu README gốc

Chủ đề liên quan

#audio#deep-learning#deepseek#gemma#glm#hacktoberfest#llm#machine-learning#model-hub#natural-language-processing#nlp#pretrained-models
Mở trên GitHub

Cùng hệ sinh thái

Repo liên quan