Toolverse
All skills

transformers

by K-Dense-AI

This skill should be used when working with pre-trained transformer models for natural language processing, computer vision, audio, or multimodal tasks. Use for text generation, classification, question answering, translation, summarization, image classification, object

Installation

Pick a client and clone the repository into its skills directory.

Installation

Quick info

Category
Security
Views
4

About this skill

This skill should be used when working with pre-trained transformer models for natural language processing, computer vision, audio, or multimodal tasks. Use for text generation, classification, question answering, translation, summarization, image classification, object detection, speech recognition, and fine-tuning models on custom datasets.

How to use

  1. Zainstaluj bibliotekę transformers i zależności: uruchom polecenie uv pip install torch transformers datasets evaluate accelerate. Dla zadań z obrazami dodaj uv pip install timm pillow, dla audio dodaj uv pip install librosa soundfile.

  2. Skonfiguruj dostęp do Hugging Face Hub — wiele modeli wymaga tokenu. Zaloguj się poleceniem huggingface-cli login lub ustaw zmienną środowiskową HUGGINGFACE_TOKEN z tokenem z https://huggingface.co/settings/tokens.

  3. Użyj Pipeline API do szybkiego wnioskowania. Zaimportuj from transformers import pipeline i utwórz pipeline dla wybranego zadania, np. pipeline("text-generation", model="gpt2") do generowania tekstu lub pipeline("text-classification") do klasyfikacji.

  4. Uruchom wnioskowanie na swoich danych — przekaż tekst, obraz lub audio do pipeline'u. Na przykład dla generowania tekstu: generator("Przyszłość AI to", max_length=50), dla klasyfikacji: classifier("Ten film był świetny!"), dla odpowiadania na pytania: `qa(question="Co to AI?", context="AI to sztuczna inteligencja...").

  5. Dla zaawansowanego dostrajania na własnych danych zamiast Pipeline API użyj bezpośrednio klas AutoModel i AutoTokenizer z biblioteki transformers, a następnie trenuj model na swoim zbiorze danych za pomocą Trainer z biblioteki transformers.

Related skills