pranjal-joshi / Screeni-py

A Python-based stock screener to find stocks with potential breakout probability from NSE India.
MIT License
541 stars 194 forks source link

Error Loading Nifty Prediction using Artifical Intelligence #127

Closed sreeramtkd closed 1 year ago

sreeramtkd commented 1 year ago

Downloaded the latest version 1.381.38 and ran the exe on windows and got the error Downloaded the sources and installed all dependecny for python and ran the python script from src directory and got the same error.

Please advice...

2022-09-11 21:39:02.642152: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found 2022-09-11 21:39:02.684162: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303) 2022-09-11 21:39:02.731798: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-CNNJ2KI 2022-09-11 21:39:02.761768: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-CNNJ2KI Traceback (most recent call last): File "screenipy.py", line 393, in File "screenipy.py", line 391, in File "screenipy.py", line 237, in main File "classes\Screener.py", line 566, in getNiftyPrediction File "classes\Utility.py", line 325, in getNiftyModel File "joblib\numpy_pickle.py", line 587, in load File "joblib\numpy_pickle.py", line 506, in _unpickle File "pickle.py", line 1212, in load File "pickle.py", line 1589, in load_reduce File "keras\saving\pickle_utils.py", line 48, in deserialize_model_from_bytecode File "keras\utils\traceback_utils.py", line 67, in error_handler File "keras\utils\traceback_utils.py", line 64, in error_handler File "keras\saving\save.py", line 209, in load_model File "keras\saving\saved_model\load.py", line 141, in load FileNotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ram://aa58af38-9775-43d5-8a19-87b10d0fb282/variables/variables You may be trying to load on a different device from the computational device. Consider setting the experimental_io_device option in tf.saved_model.LoadOptions to the io_device such as '/job:localhost'. [7316] Failed to execute script 'screenipy' due to unhandled exception!

pranjal-joshi commented 1 year ago

Hi @sreeramtkd

Thanks for posting the error.

There is a bug while releasing v1.38. Let me fix it and I'll inform you here once done.

Please downgrade to 1.37 for the time being to continue.

Sorry for the inconvenience.

pranjal-joshi commented 1 year ago

Hi @sreeramtkd

https://github.com/pranjal-joshi/Screeni-py/blob/main/src/ml/nifty_model.pkl

Please download this file and keep it in the same folder where your src/screenipy.py or screenipy.exe file is present.

Let me know if the error vanishes or any new error after trying this.

Thanks

sreeramtkd commented 1 year ago

Thanks for your response, the error is still there with the latest nifty_model.pkl file. I think the issue is with pickle not been able to load the nifty_model file.

C:\Users\Sree\Downloads\Screeni-py-1.38\Screeni-py-1.38\Screeni-py-1.38\src>python Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import pickle with open('nifty_model.pkl', "rb") as fil: ... data = pickle.load(fil) ... 2022-09-11 23:20:06.457813: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found 2022-09-11 23:20:06.458215: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. C:\Python39\lib\site-packages\requests__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.6) or chardet (5.0.0)/charset_normalizer (2.0.4) doesn't match a supported version! warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported " Traceback (most recent call last): File "", line 2, in MemoryError


[+] This version (v1.38) is in Development mode and unreleased! C:\Python39\lib\site-packages\requests__init.py:102: RequestsDependencyWarning: urllib3 (1.26.6) or chardet (5.0.0)/charset_normalizer (2.0.4) doesn't match a supported version! warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported " 2022-09-11 23:17:12.377113: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found 2022-09-11 23:17:12.377391: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. C:\Python39\lib\site-packages\requests\init__.py:102: RequestsDependencyWarning: urllib3 (1.26.6) or chardet (5.0.0)/charset_normalizer (2.0.4) doesn't match a supported version! warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported " 2022-09-11 23:17:24.064798: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found 2022-09-11 23:17:24.065078: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. [+] Select an Index for Screening: W > Screen stocks from my own Watchlist N > Nifty Prediction using Artifical Intelligence 0 > Screen stocks by the stock names (NSE Stock Code) 1 > Nifty 50 2 > Nifty Next 50 3 > Nifty 100 4 > Nifty 200 5 > Nifty 500 6 > Nifty Smallcap 50 7 > Nifty Smallcap 100 8 > Nifty Smallcap 250 9 > Nifty Midcap 50 10 > Nifty Midcap 100 11 > Nifty Midcap 150 13 > Newly Listed (IPOs in last 2 Year) Enter > All Stocks (default) [+] Select option: N 2022-09-11 23:17:36.986329: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found 2022-09-11 23:17:36.988244: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303) 2022-09-11 23:17:36.998996: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-CNNJ2KI 2022-09-11 23:17:36.999382: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-CNNJ2KI Traceback (most recent call last): File "C:\Users\Sree\Downloads\Screeni-py-1.38\Screeni-py-1.38\Screeni-py-1.38\src\screenipy.py", line 393, in raise e File "C:\Users\Sree\Downloads\Screeni-py-1.38\Screeni-py-1.38\Screeni-py-1.38\src\screenipy.py", line 391, in main() File "C:\Users\Sree\Downloads\Screeni-py-1.38\Screeni-py-1.38\Screeni-py-1.38\src\screenipy.py", line 237, in main prediction = screener.getNiftyPrediction( File "C:\Users\Sree\Downloads\Screeni-py-1.38\Screeni-py-1.38\Screeni-py-1.38\src\classes\Screener.py", line 566, in getNiftyPrediction pkl = Utility.tools.getNiftyModel(proxyServer=proxyServer) File "C:\Users\Sree\Downloads\Screeni-py-1.38\Screeni-py-1.38\Screeni-py-1.38\src\classes\Utility.py", line 325, in getNiftyModel pkl = joblib.load('./nifty_model.pkl') File "C:\Python39\lib\site-packages\joblib\numpy_pickle.py", line 587, in load obj = _unpickle(fobj, filename, mmap_mode) File "C:\Python39\lib\site-packages\joblib\numpy_pickle.py", line 506, in _unpickle obj = unpickler.load() File "C:\Python39\lib\pickle.py", line 1212, in load dispatchkey[0] File "C:\Python39\lib\pickle.py", line 1589, in load_reduce stack[-1] = func(*args) File "C:\Python39\lib\site-packages\keras\saving\pickle_utils.py", line 48, in deserialize_model_from_bytecode model = save_module.load_model(temp_dir) File "C:\Python39\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler raise e.with_traceback(filtered_tb) from None File "C:\Python39\lib\site-packages\tensorflow\python\saved_model\load.py", line 915, in load_partial raise FileNotFoundError( FileNotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ram://748f086b-375b-409e-9d59-b4c2894c4e40/variables/variables You may be trying to load on a different device from the computational device. Consider setting the experimental_io_device option in tf.saved_model.LoadOptions to the io_device such as '/job:localhost'.

C:\Users\Sree\Downloads\Screeni-py-1.38\Screeni-py-1.38\Screeni-py-1.38\src>

pranjal-joshi commented 1 year ago

Thanks for the error logs.

I will let you know once I debug this issue.

Also I might need your help for testing/debugging this issue for Windows OS as I'm not having a Windows machine at hand.

sreeramtkd commented 1 year ago

Thanks for the error logs.

I will let you know once I debug this issue.

Also I might need your help for testing/debugging this issue for Windows OS as I'm not having a Windows machine at hand.

Happy to assist !

pranjal-joshi commented 1 year ago

Hi @sreeramtkd,

I've updated the code on new-features branch: https://github.com/pranjal-joshi/Screeni-py/tree/new-features

Please clone this branch on your local windows machine and try running the src/screenipy.py file. (Delete the nifty_model.pkl in the src/ for a fresh start)

Awaiting your response.

sreeramtkd commented 1 year ago

@pranjal-joshi - Getting the same error

[+] Downloading AI model for Nifty predictions, Please Wait.. [########################################] 2/2 [100%] in 0.3s (6.40/s) 2022-09-13 10:02:02.390820: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found 2022-09-13 10:02:02.392489: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303) 2022-09-13 10:02:02.417937: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-CNNJ2KI 2022-09-13 10:02:02.418720: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-CNNJ2KI Traceback (most recent call last): File "C:\Users\Sree\Downloads\Screeni-py-main\src\screenipy.py", line 393, in raise e File "C:\Users\Sree\Downloads\Screeni-py-main\src\screenipy.py", line 391, in main() File "C:\Users\Sree\Downloads\Screeni-py-main\src\screenipy.py", line 237, in main prediction = screener.getNiftyPrediction( File "C:\Users\Sree\Downloads\Screeni-py-main\src\classes\Screener.py", line 566, in getNiftyPrediction pkl = Utility.tools.getNiftyModel(proxyServer=proxyServer) File "C:\Users\Sree\Downloads\Screeni-py-main\src\classes\Utility.py", line 325, in getNiftyModel pkl = joblib.load('nifty_model.pkl') File "C:\Python39\lib\site-packages\joblib\numpy_pickle.py", line 587, in load obj = _unpickle(fobj, filename, mmap_mode) File "C:\Python39\lib\site-packages\joblib\numpy_pickle.py", line 506, in _unpickle obj = unpickler.load() File "C:\Python39\lib\pickle.py", line 1212, in load dispatchkey[0] File "C:\Python39\lib\pickle.py", line 1589, in load_reduce stack[-1] = func(*args) File "C:\Python39\lib\site-packages\keras\saving\pickle_utils.py", line 48, in deserialize_model_from_bytecode model = save_module.load_model(temp_dir) File "C:\Python39\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler raise e.with_traceback(filtered_tb) from None File "C:\Python39\lib\site-packages\tensorflow\python\saved_model\load.py", line 915, in load_partial raise FileNotFoundError( FileNotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ram://212462ff-a3ef-4ee9-a9ac-b0afdbea9c3c/variables/variables You may be trying to load on a different device from the computational device. Consider setting the experimental_io_device option in tf.saved_model.LoadOptions to the io_device such as '/job:localhost'.

pranjal-joshi commented 1 year ago

Are you sure that you've pulled the new code from the new-features branch before running? @sreeramtkd

pranjal-joshi commented 1 year ago

Hi @sreeramtkd

I've updated the code and released a new exe.

Please download again and try: https://github.com/pranjal-joshi/Screeni-py/releases/download/1.38/screenipy.exe

sreeramtkd commented 1 year ago

Perfect !

image

pranjal-joshi commented 1 year ago

@sreeramtkd Good to know!

Thanks for being patient during the test procedure.

Does both code and EXE are working fine now? So we can close this issue.

pranjal-joshi commented 1 year ago

Fixed in 41d8d9e

Further suppression of TensorFlow Errors/Warnings is scheduled for the next update.

@sreeramtkd Thanks for your help with testing/debugging. Feel free to re-open if the issue persists.