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

Load saved model in GenericLoraModel #228

Closed
shrimonmuke0202 opened this issue Jul 7, 2023 · 2 comments
Closed

Load saved model in GenericLoraModel #228

shrimonmuke0202 opened this issue Jul 7, 2023 · 2 comments

Comments

@shrimonmuke0202
Copy link

shrimonmuke0202 commented Jul 7, 2023

Hi,
I want to load my finetuned model which I have fine-tuned using the GenericLoraModel class. But when I try to load the saved model using GenericLoraModel.load("local_path") I got the following error.

in <module> │ │ │ │ 1 from xturing.models.base import BaseModel │ │ 2 │ │ ❱ 3 model = BaseModel.load("saved_model/") │ │ 4 │ │ │ │ /usr/local/lib/python3.9/dist-packages/xturing/models/base.py:24 in load │ │ │ │ 21 │ │ │ return cls.load_from_local(weights_dir_or_model_name) │ │ 22 │ │ else: │ │ 23 │ │ │ print("Loading model from xTuring hub") │ │ ❱ 24 │ │ │ return cls.load_from_hub(weights_dir_or_model_name) │ │ 25 │ │ │ 26 │ @classmethod │ │ 27 │ def load_from_hub(cls, model_name): │ │ │ │ /usr/local/lib/python3.9/dist-packages/xturing/models/base.py:29 in load_from_hub │ │ │ │ 26 │ @classmethod │ │ 27 │ def load_from_hub(cls, model_name): │ │ 28 │ │ hub = ModelHub() │ │ ❱ 29 │ │ model_path = hub.load(model_name) │ │ 30 │ │ return cls.load_from_local(model_path) │ │ 31 │ │ │ 32 │ @classmethod │ │ │ │ /usr/local/lib/python3.9/dist-packages/xturing/utils/hub.py:27 in load │ │ │ │ 24 │ │ return item[len(self.prefix) :], self.static_path_map[item[len(self.prefix) :]] │ │ 25 │ │ │ 26 │ def load(self, path: str): │ │ ❱ 27 │ │ model_name, url = self[path] │ │ 28 │ │ model_dir = self.cache_path / model_name │ │ 29 │ │ │ │ 30 │ │ if not model_dir.exists(): │ │ │ │ /usr/local/lib/python3.9/dist-packages/xturing/utils/hub.py:21 in __getitem__ │ │ │ │ 18 │ │ │ 19 │ def __getitem__(self, item: str): │ │ 20 │ │ if item[: len(self.prefix)] != self.prefix: │ │ ❱ 21 │ │ │ raise ValueError( │ │ 22 │ │ │ │ f"Hub path {item} does not start with {self.prefix}, so it is not a vali │ │ 23 │ │ │ ) │ │ 24 │ │ return item[len(self.prefix) :], self.static_path_map[item[len(self.prefix) :]] │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ValueError: Hub path saved_model/ does not start with x/, so it is not a valid hub path.

@tushar2407
Copy link
Contributor

Hi @shrimonmuke0202, thanks for pointing this out. We have fixed this issue in our next release. Should be fixed in a day or 2.

@StochasticRomanAgeev
Copy link
Contributor

StochasticRomanAgeev commented Jul 12, 2023

Hi again, @shrimonmuke0202
We released new version with fix for this issue.
In some minutes also will be in pypy.

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

3 participants