Spaces:
Sleeping
Sleeping
| #!/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) | |