OpenPrompt icon indicating copy to clipboard operation
OpenPrompt copied to clipboard

problem with openprompt

Open komi786 opened this issue 1 year ago • 1 comments

i tried to use latest version of openprompt (pip install openprompt and aslo tried by cloning from github) with transformer 4.41 and 4.42 b

`oduleNotFoundError Traceback (most recent call last) Cell In[2], line 9 7 print(transformers.version) 8 print(transformers.file) ----> 9 import openprompt 10 print(openprompt.version) 11 print(openprompt.file)

File /usr/local/lib/python3.10/dist-packages/openprompt/init.py:2 1 version = "1.0.1" ----> 2 from .pipeline_base import PromptDataLoader, PromptModel, PromptForClassification, PromptForGeneration 3 from .utils import * 4 from .prompt_base import Template, Verbalizer

File /usr/local/lib/python3.10/dist-packages/openprompt/pipeline_base.py:4 2 from torch.utils.data.sampler import RandomSampler 3 from transformers.configuration_utils import PretrainedConfig ----> 4 from transformers.generation_utils import GenerationMixin 5 import torch 6 import torch.nn as nn

ModuleNotFoundError: No module named 'transformers.generation_utils'`

komi786 avatar May 18 '24 10:05 komi786

change from transformers.generation_utils import GenerationMixin to from transformers import GenerationMixin can solve the problem

I reported this a few days ago: https://github.com/thunlp/OpenPrompt/issues/309

xiyang-aads-lilly avatar May 20 '24 13:05 xiyang-aads-lilly