# Transformer pipeline load local pipeline

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftransformer-pipeline-load-local-pipeline%2F50127%3E%5C
**Category:** 🤗Transformers\
**Created:** [August 9, 2023, 12:18pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftransformer-pipeline-load-local-pipeline%2F50127 "2023-08-09T12:18:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![astrung](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@astrung](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fastrung)%5C
**Post date:** [August 9, 2023, 12:18pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftransformer-pipeline-load-local-pipeline%2F50127%2F1 "2023-08-09T12:18:07Z")

</div>

Hi. I have fine-tuned a model, then save it to local disk. But when I load my local mode with pipeline, it looks like pipeline is finding model from online repositories. How can i fix it ? Please help.

My code for training and save model to local disk:

from transformers import Seq2SeqTrainingArguments

```
training_args = Seq2SeqTrainingArguments(
    output_dir="./my_local_disk",
    per_device_train_batch_size=16,
    max_steps=4000,
    fp16=True,
    logging_steps=25,
    report_to=["tensorboard"],
    load_best_model_at_end=True,
    greater_is_better=False,
    push_to_hub=False,
)

```

Then I load it to pipeline:

```
from transformers import pipeline
pipe = pipeline(model="./my_local_disk")

```

But I got this error when create pipeline object:

```
OSError: ./my_local_disk does not appear to have a file named config.json. 
Checkout 'https://huggingface.co/./my_local_disk/None' for available files.

```

It looks like pipeline is loading from online repositories, not my local folder. Please help me fix it

---

<div class="post-metadata">

**Author:** ![wszq](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/wszq/32/18403_2.png) [@wszq](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fwszq)%5C
**Post date:** [August 9, 2023, 12:41pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftransformer-pipeline-load-local-pipeline%2F50127%2F2 "2023-08-09T12:41:21Z")

</div>

you can use absolute path

---

<div class="post-metadata">

**Author:** ![astrung](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@astrung](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fastrung)%5C
**Post date:** [August 9, 2023, 2:49pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftransformer-pipeline-load-local-pipeline%2F50127%2F3 "2023-08-09T14:49:47Z")

</div>

sorry but still same error.  
I am running notebooks code in colab, so my absoluted path is `/content/my_local_disk`  
But even when I use absoluted path, it still show error:

```
OSError: /content/my_local_disk does not appear to have a file named config.json. Checkout 'https://huggingface.co//content/my_local_disk/None' for available files.

```

---

<div class="post-metadata">

**Author:** ![astrung](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@astrung](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fastrung)%5C
**Post date:** [August 9, 2023, 10:43pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftransformer-pipeline-load-local-pipeline%2F50127%2F5 "2023-08-09T22:43:19Z")

</div>

Sorry but can anyone help ??

---

<div class="post-metadata">

**Author:** ![astrung](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@astrung](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fastrung)%5C
**Post date:** [August 11, 2023, 3:20am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftransformer-pipeline-load-local-pipeline%2F50127%2F6 "2023-08-11T03:20:51Z")

</div>

please can anyone help me ?  
i am stucked at this step

---

<div class="post-metadata">

**Author:** ![adam-zettafi](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/adam-zettafi/32/17173_2.png) [@adam-zettafi](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fadam-zettafi)%5C
**Post date:** [August 11, 2023, 3:58pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftransformer-pipeline-load-local-pipeline%2F50127%2F7 "2023-08-11T15:58:05Z")

</div>

The “output\_dir” on training args is for saving the checkpoints during refinement. You need to call `save_model` on your `Trainer` instance to actually save the model.

---

<div class="post-metadata">

**Author:** ![astrung](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@astrung](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fastrung)%5C
**Post date:** [August 13, 2023, 1:37am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftransformer-pipeline-load-local-pipeline%2F50127%2F8 "2023-08-13T01:37:01Z")

</div>

@adam-zettafi  
thank you for your help. And after that, how can I load saved model ?  
Do I still need to define `Trainer` again ? In this case, I think using pipeline will be better, because we don’t need to duplicated code to define `Trainer` again

---

<div class="post-metadata">

**Author:** ![adam-zettafi](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/adam-zettafi/32/17173_2.png) [@adam-zettafi](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fadam-zettafi)%5C
**Post date:** [August 14, 2023, 1:46pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftransformer-pipeline-load-local-pipeline%2F50127%2F9 "2023-08-14T13:46:02Z")

</div>

Once you save the model, you can provide the path to the saved model just as you would provide the path to any model. Your code sample was the correct way to load it.

---

<div class="post-metadata">

**Author:** ![talrejanikhil](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/talrejanikhil/32/23230_2.png) [@talrejanikhil](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ftalrejanikhil)%5C
**Post date:** [March 4, 2024, 3:43pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftransformer-pipeline-load-local-pipeline%2F50127%2F11 "2024-03-04T15:43:26Z")

</div>

So this is what worked for me

```auto
from transformers import pipeline
pipe = pipeline(task="your-task-name", model="./my_local_disk", tokenizer=original_tokenizer)

```

where original\_tokenizer is the Tokenizer you used while creating the training/test data
