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

I have a problem trained model with tensorflow on transformer pipeline male error #21056

Closed
danial1995 opened this issue Jan 8, 2023 · 2 comments

Comments

@danial1995
Copy link

danial1995 commented Jan 8, 2023

Click to expand!

Issue Type

Bug

Have you reproduced the bug with TF nightly?

Yes

Source

source

Tensorflow Version

2.8

Custom Code

Yes

OS Platform and Distribution

No response

Mobile device

No response

Python version

No response

Bazel version

No response

GCC/Compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current Behaviour?

i’m using this github text summarization and I have a problem. I have been struggling for two week and I could not figure that out.
im using a notebook from this github repository:
https://github.com/flogothetis/Abstractive-Summarization-T5-Keras

notebook link:
https://github.com/flogothetis/Abstractive-Summarization-T5-Keras/blob/main/AbstractiveSummarizationT5.ipynb

after train model i wanna use huggingface transformer pipe line to generate summerization
from transformers import pipeline
summarizer = pipeline(“summarization”, model=model, tokenizer=“t5-small”, framework=“tf”)
summarizer(“some text”)

but it pop out an error:

AttributeError: ‘Functional’ object has no attribute 'config’

Anyone has any idea how can i solve it?

full error:
AttributeError Traceback (most recent call last)
/tmp/ipykernel_20/1872405895.py in
----> 1 summarizer = pipeline(“summarization”, model=model, tokenizer=“t5-small”, framework=“tf”)
2
3 summarizer(“The US has passed the peak on new coronavirus cases, President Donald Trump said and predicted that some states would reopen”)

/opt/conda/lib/python3.7/site-packages/transformers/pipelines/init.py in pipeline(task, model, config, tokenizer, framework, revision, use_fast, use_auth_token, model_kwargs, **kwargs)
432 break
433
→ 434 return task_class(model=model, tokenizer=tokenizer, modelcard=modelcard, framework=framework, task=task, **kwargs)

/opt/conda/lib/python3.7/site-packages/transformers/pipelines/text2text_generation.py in init(self, *args, **kwargs)
37
38 def init(self, *args, **kwargs):
—> 39 super().init(*args, **kwargs)
40
41 self.check_model_type(

/opt/conda/lib/python3.7/site-packages/transformers/pipelines/base.py in init(self, model, tokenizer, modelcard, framework, task, args_parser, device, binary_output)
548
549 # Update config with task specific parameters
→ 550 task_specific_params = self.model.config.task_specific_params
551 if task_specific_params is not None and task in task_specific_params:
552 self.model.config.update(task_specific_params.get(task))

AttributeError: ‘Functional’ object has no attribute 'config’



### Standalone code to reproduce the issue

```shell
summarizer = pipeline(“summarization”, model=model, tokenizer=“t5-small”, framework=“tf”)
summarizer(“some text”)

but it pop out an error:

AttributeError: ‘Functional’ object has no attribute 'config’

Relevant log output

No response

@danial1995 danial1995 changed the title applying a traied model with tensorflow on transformer pipeline pop out error I have a problem trained model with tensorflow on transformer pipeline male error Jan 9, 2023
@sgugger
Copy link
Collaborator

sgugger commented Jan 9, 2023

You are using a Keras model here, but the pipeline can only deal with TFPreTrainedModels (models of the Transformers library).

@github-actions
Copy link

github-actions bot commented Feb 8, 2023

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

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