Spaces:
Sleeping
Sleeping
File size: 2,040 Bytes
23c518c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
#!/usr/bin/env python3
"""
Test script to verify FinGPT integration
"""
import os
import sys
def test_imports():
"""Test if all required imports work"""
try:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
print("β
All FinGPT imports successful")
return True
except ImportError as e:
print(f"β Import error: {e}")
return False
def test_model_config():
"""Test model configuration"""
try:
# Test if we can access the model configuration
FINGPT_MODEL_NAME = "Starfish55/fingpt-complete"
print(f"β
Model configuration: {FINGPT_MODEL_NAME}")
return True
except Exception as e:
print(f"β Model configuration error: {e}")
return False
def test_app_import():
"""Test if the main app can be imported"""
try:
# Add current directory to path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
# Import the main app
import app
print("β
App import successful")
return True
except Exception as e:
print(f"β App import error: {e}")
return False
def main():
"""Run all tests"""
print("π§ͺ Testing FinGPT Integration...")
print("=" * 50)
tests = [
test_imports,
test_model_config,
test_app_import
]
passed = 0
total = len(tests)
for test in tests:
if test():
passed += 1
print()
print("=" * 50)
print(f"π Test Results: {passed}/{total} tests passed")
if passed == total:
print("π All tests passed! FinGPT integration is ready.")
else:
print("β οΈ Some tests failed. Please check the errors above.")
return passed == total
if __name__ == "__main__":
success = main()
sys.exit(0 if success else 1)
|