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

May I ask how to maintain modifications to the model code file? #111

Closed
wendashi opened this issue Jun 27, 2024 · 6 comments
Closed

May I ask how to maintain modifications to the model code file? #111

wendashi opened this issue Jun 27, 2024 · 6 comments

Comments

@wendashi
Copy link

When I try to change the code in '/path/to/.cache/modelscope/modelscope_modules/cv_anytext_text_generation_editing/ms_wrapper.py', I found it would be downloaded from modelscope every time, so the modifications are covered.

and i try to change the source code
pipe = pipeline('my-anytext-task', model='damo/cv_anytext_text_generation_editing', model_revision='v1.1.3')

to use local path

pipe = pipeline('my-anytext-task', model='/path/to/.cache/modelscope/modelscope_modules/cv_anytext_text_generation_editing', model_revision='v1.1.3')

It turns out as following:

type must be a str or valid type, but got <class 'NoneType'>
  File "/path/to/AnyText/inference.py", line 14, in <module>
    pipe = pipeline('my-anytext-task', model=model_path, model_revision='v1.1.3')
TypeError: type must be a str or valid type, but got <class 'NoneType'>

Hope you can provide me some advice, THX a lot ❤️

@tyxsspa
Copy link
Owner

tyxsspa commented Jun 27, 2024

try modify this file instead:
/path/to/.cache/modelscope/hub/damo/cv_anytext_text_generation_editing/ms_wrapper.py

@wendashi
Copy link
Author

It seems like didn't work 😭

image

And the path is right cause "Model is loaded from cache." is printed in the CLI.

image

@tyxsspa
Copy link
Owner

tyxsspa commented Jun 27, 2024

No, not /home/stone/.cache/modelscope/modelscope_modules/cv_anytext_text_generation_editing/ms_wrapper.py, but /home/stone/.cache/modelscope/hub/damo/cv_anytext_text_generation_editing/ms_wrapper.py😄
During inference, the previous file is always copied from the subsequent file. Therefore, you need to modify the subsequent file.

@wendashi
Copy link
Author

The same error 😂

image

@tyxsspa
Copy link
Owner

tyxsspa commented Jun 27, 2024

keep the default value of model='damo/cv_anytext_text_generation_editing', then modelscope will find the ms_wrapper.py there.

@wendashi
Copy link
Author

I see, Thank U so much!

I only need to modify this file instead:
/path/to/.cache/modelscope/hub/damo/cv_anytext_text_generation_editing/ms_wrapper.py

and keep pipe = pipeline('my-anytext-task', model='damo/cv_anytext_text_generation_editing', model_revision='v1.1.3') as default.

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