# C2W1 Assignment | Grader Error in split\_data & create\_model function

**URL:** <https://community.deeplearning.ai/t/c2w1-assignment-grader-error-in-split-data-create-model-function/147681>\
**Category:** Convolutional Neural Networks in TensorFlow\
**Tags:** week-module-1\
**Created:** [June 26, 2022, 8:13am UTC](https://community.deeplearning.ai/t/c2w1-assignment-grader-error-in-split-data-create-model-function/147681 "2022-06-26T08:13:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aviral\_Verma1](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Aviral\_Verma1](https://community.deeplearning.ai/u/Aviral_Verma1)\
**Post date:** [June 26, 2022, 8:13am UTC](https://community.deeplearning.ai/t/c2w1-assignment-grader-error-in-split-data-create-model-function/147681/1 "2022-06-26T08:13:20Z")

</div>

Hello Everyone,  
I am getting the following error,

Details of failed tests for split\_data

Failed test case: There was an error grading this function. Details shown in ‘got’ value below:.  
Expected:  
no exceptions,  
but got:  
[Errno 2] No such file or directory: ‘./data/images-zero/cats/’.

Failed test case: There was an error grading this function. Details shown in ‘got’ value below:.  
Expected:  
no exceptions,  
but got:  
[Errno 2] No such file or directory: ‘./data/images/’.

My code is working perfectly fine in the notebook and I have even trained the model with 98% training accuracy and 82% validation accuracy but still I am getting no directory error with the grader.  
Please Help!

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [June 26, 2022, 8:43am UTC](https://community.deeplearning.ai/t/c2w1-assignment-grader-error-in-split-data-create-model-function/147681/2 "2022-06-26T08:43:29Z")

</div>

In `split_data`, are you using function parameters and not global variables or hardcoding paths?

---

<div class="post-metadata">

**Author:** ![Aviral\_Verma1](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Aviral\_Verma1](https://community.deeplearning.ai/u/Aviral_Verma1)\
**Post date:** [June 26, 2022, 8:45am UTC](https://community.deeplearning.ai/t/c2w1-assignment-grader-error-in-split-data-create-model-function/147681/3 "2022-06-26T08:45:26Z")

</div>

Yes, this is my code:

[code removed - moderator]

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [June 26, 2022, 8:47am UTC](https://community.deeplearning.ai/t/c2w1-assignment-grader-error-in-split-data-create-model-function/147681/4 "2022-06-26T08:47:01Z")

</div>

Please click my name and message your notebook as an attachment.

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [June 26, 2022, 9:14am UTC](https://community.deeplearning.ai/t/c2w1-assignment-grader-error-in-split-data-create-model-function/147681/5 "2022-06-26T09:14:26Z")

</div>

The problem is due to `os.chdir`.

The sideeffect of using the above function call is that the interpreter current working directory is changed from the directory where the notebook execution began. As a result, when the grader invokes `split_data` function with a relative path like `./data/images/`, the context is borrowed from `/tmp/cats-v-dogs/validation` to get the absolute path to directory.

Please create directories without using `os.chdir`.
