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

InferenceModel class do not have from_pretrained() #7

Open
akira-sasaki opened this issue Jun 16, 2022 · 9 comments
Open

InferenceModel class do not have from_pretrained() #7

akira-sasaki opened this issue Jun 16, 2022 · 9 comments

Comments

@akira-sasaki
Copy link

I build cogview2 with colab.
And run your script, I have this error.

InferenceModel class do not have from_pretrained().

!./text2image.sh --input-source input.txt
WARNING: No training data specified
using world size: 1 and model-parallel size: 1 
Traceback (most recent call last):
  File "cogview2_text2image.py", line 233, in <module>
    main(args)
  File "cogview2_text2image.py", line 48, in main
    model, args = InferenceModel.from_pretrained(args, 'coglm')
AttributeError: type object 'InferenceModel' has no attribute 'from_pretrained'

Are there any omissions in the committed sources?

@Sleepychord
Copy link
Contributor

This is strange, InferenceModel should have this method by Inheriting. Could you share your version of Python and SwissArmyTransformer(you can upgrade it to 0.2.3 and try again)?

@akira-sasaki
Copy link
Author

I used old version SwissArmyTransformer==0.1.2.
I update to 0.2.3 and try again.

@akira-sasaki
Copy link
Author

I had error, again

Traceback (most recent call last):
  File "cogview2_text2image.py", line 19, in <module>
    from SwissArmyTransformer import get_args, get_tokenizer
  File "/usr/local/lib/python3.7/dist-packages/SwissArmyTransformer/__init__.py", line 4, in <module>
    from .model import AutoModel
  File "/usr/local/lib/python3.7/dist-packages/SwissArmyTransformer/model/__init__.py", line 3, in <module>
    from .encoder_decoder_model import EncoderDecoderModel
  File "/usr/local/lib/python3.7/dist-packages/SwissArmyTransformer/model/encoder_decoder_model.py", line 87
    return encoder_outputs, decoder_outputs, *mems
                                             ^
SyntaxError: invalid syntax

I use python 3.7, which version of Python should I use? 

@Sleepychord
Copy link
Contributor

according to this issue #4 , maybe you should upgrade it to python 3.8.

@metaphorz
Copy link

Can you share the Colab notebook? I can periodically try it and pray that I get an A100.

@chenxwh
Copy link
Contributor

chenxwh commented Jun 17, 2022

@metaphorz Here is Replicate demo that is backed with A100 if you are interested :) https://replicate.com/thudm/cogview2

@metaphorz
Copy link

@chenxwh thank you I will try

@akira-sasaki
Copy link
Author

@metaphorz
I shared colab working.
https://github.com/akira-sasaki/playground/blob/main/CogView2.ipynb

The GPU memory is 16GB at ColabPro+.
So, we need --only-first-stage option.

If you want to make it all work, you might need an A100.

@metaphorz
Copy link

@akira-sasaki thanks very much.

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

4 participants