Can't instantiate abstract class Pipeline with abstract methods
Author: m7mdhka
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.45.1
- Platform: Windows-10-10.0.20348-SP0
- Python version: 3.11.9
- Huggingface_hub version: 0.25.0
- Safetensors version: 0.4.3
- Accelerate version: 0.31.0
- Accelerate config: 	not found
- PyTorch version (GPU?): 2.3.1+cu121 (True)
- Tensorflow version (GPU?): 2.13.1 (False)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: <fill in>
- Using GPU in script?: <fill in>
- GPU type: NVIDIA GeForce RTX 4090

### Who can help?

@ArthurZucker @Rocketknight1

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

```
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
    pretrained_model_name_or_path="./llms/phi-3/mini-4k-instruct",
    device_map="cuda",
    torch_dtype="auto",
    trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("./tokenizers/phi-3/mini-4k-instruct")
from transformers import Pipeline

generator = Pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
    return_full_text=False,
    max_new_tokens=500,
    do_sample=False
)
```

Error Message:
```
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[5], [line 3](vscode-notebook-cell:?execution_count=5&line=3)
      [1](vscode-notebook-cell:?execution_count=5&line=1) from transformers import Pipeline
----> [3](vscode-notebook-cell:?execution_count=5&line=3) generator = Pipeline(
"text-generation",
...
)

TypeError: Can't instantiate abstract class Pipeline with abstract methods _forward, _sanitize_parameters, postprocess, preprocess

### Expected behavior

Inference without bugs.

Comments:
the error is because of your import  it should be `pipeline` with a small p not a capital P and also try running this code 

```python 
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
    pretrained_model_name_or_path="gpt2",
    device_map="cuda",
    torch_dtype="auto",
    trust_remote_code=True
)

tokenizer = AutoTokenizer.from_pretrained("gpt2")

# Create the text generation pipeline
generator = pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
    return_full_text=False,
    max_new_tokens=20,
    do_sample=False
)

# Example usage
input_text = "Once upon a time"
generated_texts = generator(input_text)
print(generated_texts)
#gen_text - > [{'generated_text': ', the world was a place of great beauty and great danger. The world was a place of great danger, and the world was a place of great danger. The world was a place of great danger, and the world was a place of great 
```



@dame-cell Thank you.