-
Notifications
You must be signed in to change notification settings - Fork 11
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
Cannot load model if model directory contains symlinks #38
Comments
I can't say I know Rust, but I suspect that the problem could be related to this line that checks whether the file is a regular file: Line 188 in 487ad9c
I suggest making it an OR clause with is_symlink() also passing the test and activating the |
Yeah you're right. Thedoc says
I should probably just get rid of the I should probably also throw an error / print an warning if no tree is loaded to avoid confusion. |
It would have made problems like #38 easier to diagnose and debug
It would have made problems like #38 easier to diagnose and debug
It would have made problems like #38 easier to diagnose and debug
Great, thanks a lot @tomtung ! |
I'm trying to adapt Omikuji (via the integration with Annif) into a Data Version Control workflow. In DVC, large model files are typically stored in a cache outside the working tree (which is a git repository). There are several ways to keep the working directory synchronized with the cache, but one common solution is the use of symbolic links. This means that model files will be moved to the cache directory and replaced with symlinks that point to the original files.
I noticed that Omikuji has problems loading the model if the files in the model directory (
settings.json
,tree0.cbor
,tree1.cbor
...) aren't regular files but symlinks. Loading the model apparently succeeds, but all the predictions are empty. I was able demonstrate this without involving DVC, by editing the Python example into this:The result of running this:
The suspicious part is the model loading (it should take more than 0.00s) and then the empty list of predictions.
I wonder if there's a good reason why the model files have to be actual files. Normally it doesn't matter whether a file used for a read operation is a regular file or a symlink; as long as the symlink points to an actual file (with the correct permissions etc.) that should work fine.
Some information about the system:
Ubuntu Linux 20.04 amd64, ext4 filesystem
Python 3.8.10
Omikuji 0.4.1 installed in a virtual environment with pip
The text was updated successfully, but these errors were encountered: