Closed snufkinwa closed 3 days ago
Removing @click.option("--repo_path", "-r", default=None, type=click.STRING)
causes the code to break. To fix this, we can use the or
operator in the ModelFetcher
constructor to prioritize from_dir
as the replacement for repo_path
.
On my Mac, CMake is missing, so while the fetch
command works to retrieve the model, the build process fails. I ran test_models.py
, that successfully completed without issues. Additionally, I wrote a few unit tests to ensure --from_dir
is prioritized correctly in the absence of repo_path
.
@snufkinwa we actually need to remove the flag from the CLI which I don't see being addressed in this PR.
Everything on /hub/fetch/fetch.py
was reverted back, that was the reason I was getting error when trying to remove --repo_path
, then add from_dir
to the constructor. The only file edited was cli/commands/fetch.py
. Tested several times with test_models.py
It fetched successfully.
File "/home/runner/work/ersilia/ersilia/ersilia/cli/commands/__init__.py", line 22, in wrapper
return func(*args, **kwargs)
TypeError: fetch_cmd.<locals>.fetch() missing 1 required positional argument: 'repo_path'
This is the error I was getting originally, this happens with the removal of @click.option("--repo_path", "-r", default=None, type=click.STRING)
The test_models.py
was tested several times, it didn't give me that error when fetching, but the additional test on the PR produced the same error. It has something to do with BentoML
, as the line in question is in function def bentoml_common_params(func)
File "/home/runner/work/ersilia/ersilia/ersilia/cli/commands/__init__.py", line 22, in wrapper return func(*args, **kwargs) TypeError: fetch_cmd.<locals>.fetch() missing 1 required positional argument: 'repo_path'
This is the error I was getting originally, this happens with the removal of
@click.option("--repo_path", "-r", default=None, type=click.STRING)
The
test_models.py
was tested several times, it didn't give me that error when fetching, but the additional test on the PR produced the same error. It has something to do withBentoML
, as the line in question is in functiondef bentoml_common_params(func)
@snufkinwa this happens because we still need to remove repo_path
from the arguments that the fetch
function gets here.
LGTM @snufkinwa thanks!
Thank you for taking your time to contribute to Ersilia, just a few checks before we proceed
Description
The
--repo_path
and--from_dir
flags both serve the same purpose: specifying the local path to a model's directory. Right now,--from_dir
is only used to set the model source, while most users rely on--repo_path
to load local models. To keep naming consistent with other flags (like--from_github
and--from_dockerhub
), we should use--from_dir
and remove--repo_path
.Changes to be made
--repo_path
flag in favor of only keeping the --from_dir
flag.repo_path
argument in theModelFetcher
class's constructor with the value the user inputs throughfrom_dir
.Status
Ready to Review
To do
fetch
command is working properlyclass TestModelFetcher(unittest.TestCase):
if name == 'main': unittest.main()