1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Kernel crashing while using transformer and tensorflow

Discussão em 'Python' iniciado por Stack, Outubro 1, 2024 às 07:23.

  1. Stack

    Stack Membro Participativo

    I am new to Python and I am playing around with an open-source dataset and decided to use a text summarization library for which I installed transformers. Later I found out that there were some prerequisite libraries that I should have installed so by going through some forums in stackoverflow, I installed below packages using pip command in anaconda prompt with mentioned versions:

    • transformers --> 4.45.1
    • tensorflow --> 2.17.0
    • numpy --> 1.26.4
    • keras --> 3.5.0

    The import library command in my code looks like below:

    import pandas as pd
    from transformers import pipeline
    import os

    os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
    import tensorflow as tf


    When I try to run below code, I get error message like No model was supplied defaulted to google-t5/t-5-small and revision df1b051 (https://huggingface.co/google-t5/t5-small. Using a pipeline without specifying a model name and revision in production is not recommended and then the kernel crashes with this error message "You may see slightly different numerical results due to floating-point round-off from different computation orders. To turn them off set the environment variable 'TF_ENABLE_ONEDNN_OPTS' = '0' as attached in the screenshots --> No Model was supplied error. Kernel crash error

    #loading summarization pipeline

    summarizer = pipeline("summarization")

    text = "Here comes Capcom’s newest challenger! Street Fighter™ 6 launches worldwide on June 2nd, 2023 and represents the next evolution of the Street Fighter™ series! Street Fighter 6 spans three distinct game modes, including World Tour, Fighting Ground and Battle Hub."

    #summarize text

    summary = summarizer(text , max_length = 30 , min_length = 10 , do_sample = False)

    print(summary)


    I used below code to solve the environment variable issue and even then I am getting this error message:

    os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
    import tensorflow as tf


    The thing is that I am receiving 2 kinds of errors - One which says that no model is available to use the pipeline and other one is related to environment variable.

    I would appreciate some guidance in this matter.

    Continue reading...

Compartilhe esta Página