Skip to content

Commit

Permalink
fix pipelines example
Browse files Browse the repository at this point in the history
  • Loading branch information
jiqing-feng committed Jan 8, 2024
1 parent 2bf2122 commit db10723
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions optimum/intel/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,20 +236,11 @@ def pipeline(
Examples:
```python
>>> from transformers import pipeline, AutoModelForTokenClassification, AutoTokenizer
>>> import torch
>>> from optimum.intel.pipelines import pipeline
>>> # Sentiment analysis pipeline
>>> analyzer = pipeline("sentiment-analysis")
>>> # Question answering pipeline, specifying the checkpoint identifier
>>> oracle = pipeline(
... "question-answering", model="distilbert-base-cased-distilled-squad", tokenizer="bert-base-cased"
... )
>>> # Named entity recognition pipeline, passing in a specific model and tokenizer
>>> model = AutoModelForTokenClassification.from_pretrained("dbmdz/bert-large-cased-finetuned-conll03-english")
>>> tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
>>> recognizer = pipeline("ner", model=model, tokenizer=tokenizer)
>>> pipe = pipeline('text-generation', 'gpt2', torch_dtype=torch.bfloat16)
>>> pipe("Describe a real-world application of AI in sustainable energy.")
```"""
if model_kwargs is None:
model_kwargs = {}
Expand Down

0 comments on commit db10723

Please sign in to comment.