Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meet a 'ValueError: Invalid filepath extension for saving' in training #129

Open
lindawillli opened this issue Sep 25, 2024 · 2 comments
Open

Comments

@lindawillli
Copy link

Hello, I got a 'ValueError: Invalid filepath extension for saving' when I used 'scaden train' function. I had use Scaden successfully before, but this time I met this error. How could I solve this problem? I am looking forward to your reply. Thank you very much.

My code is shown below.
pip install scaden
scaden simulate --data example_data/ -n 100 --pattern "*_counts.txt"
scaden process data.h5ad example_data/example_bulk_data.txt
scaden train processed.h5ad --steps 5000 --model_dir model

Then I got an error.
ValueError: Invalid filepath extension for saving. Please add either a .keras extension for the native Keras format (recommended) or a .h5 extension. Use model.export(filepath) if you want to export a SavedModel for use with TFLite/TFServing/etc. Received: filepath=model/m256.

@sxu509
Copy link

sxu509 commented Sep 29, 2024

Hi, I got same issues too, I figure out by:

Open the Scaden script (scaden.py) or locate the line in scaden/model/scaden.py: self.model.save(self.model_dir)
(in python/lib/site-packages/scaden)

And change to:
os.makedirs(self.model_dir, exist_ok=True)
self.model.save(self.model_dir + "model.keras")

And the example works!

@lindawillli
Copy link
Author

lindawillli commented Sep 30, 2024

Thank you very much for your reply! Your method directly solved my problem!
I also made some attempts and just confirmed that they would be effective as well.
I used Docker. It's worth noting that the scaden version in Docker is v1.1.1. To avoid new errors, I updated pip, scaden (from 1.1.1 to 1.1.2), and anndata (from 0.7.6 to 0.8.0) after running the container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants