hatespeech-detection / tests /test_imports.py
jl
feat(file upload): added file upload and updated file structure to be readeable
198730e
"""Test script to check imports and identify version issues"""
import sys
print("Python version:", sys.version)
print("\n" + "="*50)
print("Testing imports...")
print("="*50)
try:
import torch
print(f"βœ“ torch: {torch.__version__}")
except Exception as e:
print(f"βœ— torch: {e}")
try:
import transformers
print(f"βœ“ transformers: {transformers.__version__}")
except Exception as e:
print(f"βœ— transformers: {e}")
try:
import huggingface_hub
print(f"βœ“ huggingface_hub: {huggingface_hub.__version__}")
except Exception as e:
print(f"βœ— huggingface_hub: {e}")
try:
import streamlit
print(f"βœ“ streamlit: {streamlit.__version__}")
except Exception as e:
print(f"βœ— streamlit: {e}")
try:
import plotly
print(f"βœ“ plotly: {plotly.__version__}")
except Exception as e:
print(f"βœ— plotly: {e}")
try:
import pandas
print(f"βœ“ pandas: {pandas.__version__}")
except Exception as e:
print(f"βœ— pandas: {e}")
try:
import numpy
print(f"βœ“ numpy: {numpy.__version__}")
except Exception as e:
print(f"βœ— numpy: {e}")
print("\n" + "="*50)
print("Checking transformers dependencies...")
print("="*50)
try:
from transformers import AutoModel, AutoTokenizer
print("βœ“ Successfully imported AutoModel and AutoTokenizer")
except Exception as e:
print(f"βœ— Error importing from transformers: {e}")
import traceback
traceback.print_exc()