# Saving Checkpoint on S3 using Trainer

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsaving-checkpoint-on-s3-using-trainer%2F49867%3E%5C
**Category:** 🤗Transformers\
**Created:** [August 7, 2023, 8:28pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsaving-checkpoint-on-s3-using-trainer%2F49867 "2023-08-07T20:28:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sid0212](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@Sid0212](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FSid0212)%5C
**Post date:** [August 7, 2023, 8:28pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsaving-checkpoint-on-s3-using-trainer%2F49867%2F1 "2023-08-07T20:28:35Z")

</div>

I am using Trainer and in the TraningArgument I am passing a s3 location, My Sagemaker notebook has access to S3 and I am able to save data directly to s3 from the notebook. but when I pass the same in the Trainer output\_dir it create the same folder structure in the current director. and does not send it to s3. Is there a way I can prohibit the Trainer to create dir struct. Because when I delete the folder that it send the run details to the s3 but At the same time whenever it save a checkpoint it again checks for the folder and as it is not present it creates a new one.

training\_args = Seq2SeqTrainingArguments(  
output\_dir=‘s3://path/to/folder/’,  
evaluation\_strategy=EVALUATION\_STRATEGY,  
save\_strategy = SAVE\_STRATEGY,  
learning\_rate=LEARNING\_RATE,  
per\_device\_train\_batch\_size=BATCH\_SIZE,  
per\_device\_eval\_batch\_size=BATCH\_SIZE,  
weight\_decay=WEIGHT\_DECAY,  
save\_total\_limit=SAVE\_TOTAL\_LIMIT,  
num\_train\_epochs=EPOCH,  
predict\_with\_generate=PREDICT\_WITH\_GENERATE,  
fp16=FP16,  
# resume\_from\_checkpoint=RESUME\_FROM\_CHECKPOINT,  
load\_best\_model\_at\_end = LOAD\_BEST\_MODEL\_AT\_END,  
)

I am doing this as I do not have save the file on notebook disk
