Skip to content

Not generating required output #10

Open
@usmanali-arshi

Description

@usmanali-arshi

When I try to input : "def factorial", it gives me the following error. Could you please help me resolve it? Thanks.

File "interact.py", line 52, in
outputs = model.generate(input_ids=input_ids.to("cuda") if args.use_cuda else input_ids,
File "/home/ua383/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 575, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'GPT2LMHeadModel' object has no attribute 'generate'

Activity

wangcongcong123

wangcongcong123 commented on Dec 14, 2021

@wangcongcong123
Owner

Have you tried down-version the transformers?

usmanali-arshi

usmanali-arshi commented on Dec 15, 2021

@usmanali-arshi
Author

Thanks for getting back to me. I've managed to run it but when I try to fine-tune it on your dataset it gives me this error:
Traceback (most recent call last):
File "train.py", line 83, in
model_trainer = ModelTrainer(model,
File "/home/ua383/work/auto_coding/trainer.py", line 328, in init
self.optimizer = optimizer_class(optimizer_grouped_parameters, **optimizer_params)
File "/home/ua383/anaconda3/envs/training/lib/python3.8/site-packages/transformers/optimization.py", line 301, in init
require_version("torch>=1.5.0") # add
with alpha
File "/home/ua383/anaconda3/envs/training/lib/python3.8/site-packages/transformers/utils/versions.py", line 114, in require_version
_compare_versions(op, got_ver, want_ver, requirement, pkg, hint)
File "/home/ua383/anaconda3/envs/training/lib/python3.8/site-packages/transformers/utils/versions.py", line 49, in _compare_versions
raise ImportError(
ImportError: torch>=1.5.0 is required for a normal functioning of this module, but found torch==1.4.0.

Although I tried installing torch>=1.5.0 versions, it still gives me the same error. Could you please help me with this issue. Thanks.

Penguin-jpg

Penguin-jpg commented on Feb 27, 2022

@Penguin-jpg

When I try to input : "def factorial", it gives me the following error. Could you please help me resolve it? Thanks.

File "interact.py", line 52, in outputs = model.generate(input_ids=input_ids.to("cuda") if args.use_cuda else input_ids, File "/home/ua383/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 575, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'GPT2LMHeadModel' object has no attribute 'generate'

Try using transformers 3.5.0. It works for me.

vishalsingha

vishalsingha commented on May 25, 2022

@vishalsingha

Try installing torch>=1.5 using the below code after uninstalling it

!pip install torch==1.5.1+cu101 torchvision==0.6.1+cu101 -f https://download.pytorch.org/whl/torch_stable.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @wangcongcong123@usmanali-arshi@vishalsingha@Penguin-jpg

        Issue actions

          Not generating required output · Issue #10 · wangcongcong123/auto_coding