FileNotFoundError: Unsuccessful TensorSliceReader constructor

Summary

I ran into a problem with code that was working fine until recently. I’m trying to run the Top2VEc model and I’m getting an error.

Steps to reproduce

Code snippet:

import pandas as pd
from top2vec import Top2Vec
import streamlit as st

@st.cache_resource()
def topic_modeling(docs):
    """Top2Vec loader."""
    model = Top2Vec(docs, embedding_model='universal-sentence-encoder-multilingual')
    return (model)

uploaded_file = st.file_uploader("Choose a file", type=['csv'], help='Accept only CSV extenction')

if uploaded_file is not None:
    df = pd.read_csv(uploaded_file)
    df=df.head(1000)
    docs = list(df.loc[:,"myColumn"].values)
    model = topic_modeling(docs)
    st.write(model)
else:
    st.write("upload file")

Expected behavior:

2-3 days ago I could execute this code without any problems.

Actual behavior:

Additional information

To run the top2vec model you need data with a column containing string in a minimum of 50 rows.

Any thoughts on what happened and how to fix it?

I have an update here. It seems to be a problem with the embedding method. I swapped to universal-sentence-encoder-multilingual-large and it works fine. It was hard to detect because the error didn’t indicate that and no changes in Top2Vec documentary noticed.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.

Hi @Keszzz

Thanks for sharing your question and solution, glad it worked out!

Best regards,
Chanin