# ValueError: Cannot use device_map='auto' with pipeline when device is explicitly set to 0. Please set device_map=None or remove device argument.

- **ID:** `huggingface/pipeline-device-map-conflict`
- **Domain:** huggingface
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

The pipeline API conflicts when both `device` and `device_map` are specified; `device_map='auto'` requires the model to be loaded with Accelerate's device mapping, which is incompatible with a fixed device index.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| transformers>=4.30.0 | active | — | — |
| accelerate>=0.20.0 | active | — | — |

## Workarounds

1. **Remove the `device` argument and use only `device_map='auto'`: pipe = pipeline('text-generation', model='model-name', device_map='auto'). This lets Accelerate handle device placement.** (95% success)
   ```
   Remove the `device` argument and use only `device_map='auto'`: pipe = pipeline('text-generation', model='model-name', device_map='auto'). This lets Accelerate handle device placement.
   ```
2. **Remove `device_map` and use `device=0` explicitly: pipe = pipeline('text-generation', model='model-name', device=0). This forces the model onto GPU 0.** (90% success)
   ```
   Remove `device_map` and use `device=0` explicitly: pipe = pipeline('text-generation', model='model-name', device=0). This forces the model onto GPU 0.
   ```

## Dead Ends

- **Set both `device=0` and `device_map='auto'` and expect the pipeline to resolve the conflict** — The pipeline raises a ValueError immediately because the two arguments are mutually exclusive. (100% fail)
- **Use `device_map='sequential'` instead of 'auto'** — The same conflict applies; any non-None device_map with an explicit device argument will raise an error. (90% fail)
- **Set `device=-1` to use CPU and keep device_map='auto'** — device_map='auto' requires at least one GPU to be available; setting device=-1 will cause a separate error about no GPU found. (80% fail)
