nateemma / strategies

Custom trading strategies using the freqtrade framework
318 stars 85 forks source link

hyopt error #35

Open Limore0129 opened 1 year ago

Limore0129 commented 1 year ago

zsh user_data/strategies/scripts/hyp_strat.sh -n 90 -e 100 -l ExpectancyHyperOptLoss binance "NNTC_macd_Transformer"

Using config file: user_data/strategies/binance/config_binance.json and Strategy dir: user_data/strategies/binance

Optimising strategy:NNTC_macd_Transformer for exchange:binance...

freqtrade hyperopt --spaces sell --hyperopt-loss ExpectancyHyperOptLoss --timerange=20230511-20230809 --epochs 100 -c user_data/strategies/binance/config_binance.json --strategy-path user_data/strategies/binance -s NNTC_macd_Transformer --min-trades 45 --no-color

2023-08-09 11:46:14,869 - freqtrade - INFO - freqtrade 2023.6.dev-0b8ef1b88 2023-08-09 11:46:14,895 - freqtrade.configuration.load_config - INFO - Using config: user_data/strategies/binance/config_binance.json ... 2023-08-09 11:46:14,896 - freqtrade.loggers - INFO - Verbosity set to 0 2023-08-09 11:46:14,896 - freqtrade.configuration.configuration - INFO - Using additional Strategy lookup path: user_data/strategies/binance 2023-08-09 11:46:14,896 - freqtrade.configuration.configuration - INFO - Using max_open_trades: 10 ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter --timerange detected: 20230511-20230809 ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Using user-data directory: /Users/limore/quant_github/freqtrade_my/user_data ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Using data directory: /Users/limore/quant_github/freqtrade_my/user_data/data/binance ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter --epochs detected ... Will run Hyperopt with for 100 epochs ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter -s/--spaces detected: ['sell'] 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter --no-color detected ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter -j/--job-workers detected: -1 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter --min-trades detected: 45 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Using Hyperopt loss class name: ExpectancyHyperOptLoss 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Filter trades by timerange: 20230511-20230809 2023-08-09 11:46:14,897 - freqtrade.exchange.check_exchange - INFO - Checking exchange... 2023-08-09 11:46:14,900 - freqtrade.exchange.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade development team. 2023-08-09 11:46:14,900 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration. 2023-08-09 11:46:14,900 - freqtrade.configuration.config_validation - INFO - Validating configuration ... 2023-08-09 11:46:14,903 - freqtrade.commands.optimize_commands - INFO - Starting freqtrade in Hyperopt mode 2023-08-09 11:46:14,903 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled 2023-08-09 11:46:14,903 - freqtrade.exchange.exchange - INFO - Using CCXT 3.1.23 2023-08-09 11:46:14,903 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'options': {'defaultType': 'swap'}, 'aiohttp_proxy': 'http://127.0.0.1:7890', 'proxies': {'http': 'http://127.0.0.1:7890', 'https': 'http://127.0.0.1:7890'}} 2023-08-09 11:46:14,907 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'options': {'defaultType': 'swap'}, 'aiohttp_proxy': 'http://127.0.0.1:7890', 'proxies': {'http': 'http://127.0.0.1:7890', 'https': 'http://127.0.0.1:7890'}} 2023-08-09 11:46:14,910 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance" 2023-08-09 11:46:18,179 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange 'Binance'... 2023-08-09 11:46:22,143 - torch.distributed.nn.jit.instantiator - INFO - Created a temporary directory at /var/folders/0h/68ps0f690bz5xn7mk5_538h40000gp/T/tmp7gxwohvr 2023-08-09 11:46:22,143 - torch.distributed.nn.jit.instantiator - INFO - Writing /var/folders/0h/68ps0f690bz5xn7mk5_538h40000gp/T/tmp7gxwohvr/_remote_module_non_scriptable.py


NNTC_macd_Transformer

Software Environment:

freqtrade:  2023.6.dev-0b8ef1b88
OS Type:    darwin (MacOS), Version: macOS-13.1-arm64-arm-64bit
python:     ['3.11.3 (main, Apr  7 2023, 20:13:31) [Clang 14.0.0 (clang-1400.0.29.202)]']
sklearn:    1.1.3
tensorflow: 2.13.0, devices:[PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU')]
keras:      2.6.0
pytorch:    2.0.1
lightning:  2.0.5
darts:      0.24.0

Strategy Parameters/Flags

Dataset Type:           DatasetType.DEFAULT (0)
Signal Type:            SignalType.MACD (macd)
Classifier Type:        ClassifierType.Transformer
Lookahead:              1.0 hours (12 candles)
n_profit_stddevs:       1.0
n_loss_stddevs:         1.0
compress_data:          True
refit_model:            False
model_per_pair:         False
combine_models:         False
ignore_exit_signals:    False

BTC/USDT:USDT Compressed data 100 -> 64 (features) holds:22895 (88.32%) buys:1432 (5.52%) sells:1596 (6.16%) predicting buys/sells... Loading existing model (/Users/limore/quant_github/freqtrade_my/user_data/strategies/binance/models/NNTC_macd_Transformer/NNTC_macd_Transformer.h5)...

ETH/USDT:USDT Compressed data 100 -> 64 (features) holds:22818 (88.02%) buys:1465 (5.65%) sells:1640 (6.33%) predicting buys/sells... Epochs ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/100 0% • 0:00:11 • -:--:-- 2023-08-09 11:47:01,585 - freqtrade - ERROR - Fatal exception! joblib.externals.loky.process_executor._RemoteTraceback: """ Traceback (most recent call last): File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/externals/loky/process_executor.py", line 391, in _process_worker call_item = call_queue.get(block=True, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/queues.py", line 122, in get return _ForkingPickler.loads(res) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/externals/loky/cloudpickle_wrapper.py", line 43, in _reconstruct_wrapper obj = loads(_pickled_object) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/pickle_utils.py", line 48, in deserialize_model_from_bytecode raise e File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/pickle_utils.py", line 46, in deserialize_model_from_bytecode model = saving_lib.load_model(filepath, safe_mode=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/saving_lib.py", line 275, in load_model raise e File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/saving_lib.py", line 240, in load_model model = deserialize_keras_object( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/serialization_lib.py", line 710, in deserialize_keras_object instance.compile_from_config(compile_config) File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/engine/training.py", line 3582, in compile_from_config self.optimizer.build(self.trainable_variables) ^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/optimizers/legacy/optimizer_v2.py", line 997, in getattribute raise e File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/optimizers/legacy/optimizer_v2.py", line 987, in getattribute return super().getattribute(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Adam' object has no attribute 'build' """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/limore/quant_github/freqtrade_new/freqtrade/main.py", line 42, in main return_code = args'func' ^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/freqtrade/commands/optimize_commands.py", line 107, in start_hyperopt hyperopt.start() File "/Users/limore/quant_github/freqtrade_new/freqtrade/optimize/hyperopt.py", line 614, in start f_val = self.run_optimizer_parallel(parallel, asked) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/freqtrade/optimize/hyperopt.py", line 439, in run_optimizer_parallel return parallel(delayed( ^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/parallel.py", line 1098, in call self.retrieve() File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/parallel.py", line 975, in retrieve self._output.extend(job.get(timeout=self.timeout)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/_parallel_backends.py", line 567, in wrap_future_result return future.result(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.get_result() ^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 401, in get_result raise self._exception joblib.externals.loky.process_executor.BrokenProcessPool: A task has failed to un-serialize. Please ensure that the arguments of the function are all picklable.

please help me check it out ,thank you . @nateemma

nateemma commented 1 year ago

I'm trying to chase this down. The problem is that 'something' is not pickle-able and hyperopt saves and reloads strategies a lot. The messages seem to indicate that this is related to a tensorflow object, so I'm going to try newer versions of tensorflow (and freqtrade) to see if this has been resolved

This is probably going to take a long time to resolve...

Thanks,

Phil

On Tue, Aug 8, 2023 at 8:49 PM Limore0129 @.***> wrote:

zsh user_data/strategies/scripts/hyp_strat.sh -n 90 -e 100 -l ExpectancyHyperOptLoss binance "NNTC_macd_Transformer"

Using config file: user_data/strategies/binance/config_binance.json and Strategy dir: user_data/strategies/binance

2023年 8月 9日 星期三 11时46分12秒 CST Optimising strategy:NNTC_macd_Transformer for exchange:binance...

freqtrade hyperopt --spaces sell --hyperopt-loss ExpectancyHyperOptLoss --timerange=20230511-20230809 --epochs 100 -c user_data/strategies/binance/config_binance.json --strategy-path user_data/strategies/binance -s NNTC_macd_Transformer --min-trades 45 --no-color

2023-08-09 11:46:14,869 - freqtrade - INFO - freqtrade 2023.6.dev-0b8ef1b88 2023-08-09 11:46:14,895 - freqtrade.configuration.load_config - INFO - Using config: user_data/strategies/binance/config_binance.json ... 2023-08-09 11:46:14,896 - freqtrade.loggers - INFO - Verbosity set to 0 2023-08-09 11:46:14,896 - freqtrade.configuration.configuration - INFO - Using additional Strategy lookup path: user_data/strategies/binance 2023-08-09 11:46:14,896 - freqtrade.configuration.configuration - INFO - Using max_open_trades: 10 ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter --timerange detected: 20230511-20230809 ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Using user-data directory: /Users/limore/quant_github/freqtrade_my/user_data ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Using data directory: /Users/limore/quant_github/freqtrade_my/user_data/data/binance ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter --epochs detected ... Will run Hyperopt with for 100 epochs ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter -s/--spaces detected: ['sell'] 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter --no-color detected ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter -j/--job-workers detected: -1 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter --min-trades detected: 45 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Using Hyperopt loss class name: ExpectancyHyperOptLoss 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Filter trades by timerange: 20230511-20230809 2023-08-09 11:46:14,897 - freqtrade.exchange.check_exchange - INFO - Checking exchange... 2023-08-09 11:46:14,900 - freqtrade.exchange.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade development team. 2023-08-09 11:46:14,900 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration. 2023-08-09 11:46:14,900 - freqtrade.configuration.config_validation - INFO

  • Validating configuration ... 2023-08-09 11:46:14,903 - freqtrade.commands.optimize_commands - INFO - Starting freqtrade in Hyperopt mode 2023-08-09 11:46:14,903 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled 2023-08-09 11:46:14,903 - freqtrade.exchange.exchange - INFO - Using CCXT 3.1.23 2023-08-09 11:46:14,903 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'options': {'defaultType': 'swap'}, 'aiohttp_proxy': 'http://127.0.0.1:7890', 'proxies': {'http': ' http://127.0.0.1:7890', 'https': 'http://127.0.0.1:7890'}} 2023-08-09 11:46:14,907 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'options': {'defaultType': 'swap'}, 'aiohttp_proxy': 'http://127.0.0.1:7890', 'proxies': {'http': ' http://127.0.0.1:7890', 'https': 'http://127.0.0.1:7890'}} 2023-08-09 11:46:14,910 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance" 2023-08-09 11:46:18,179 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange 'Binance'... 2023-08-09 11:46:22,143 - torch.distributed.nn.jit.instantiator - INFO - Created a temporary directory at /var/folders/0h/68ps0f690bz5xn7mk5_538h40000gp/T/tmp7gxwohvr 2023-08-09 11:46:22,143 - torch.distributed.nn.jit.instantiator - INFO - Writing /var/folders/0h/68ps0f690bz5xn7mk5_538h40000gp/T/tmp7gxwohvr/_remote_module_non_scriptable.py

    NNTC_macd_Transformer

Software Environment:

freqtrade: 2023.6.dev-0b8ef1b88 OS Type: darwin (MacOS), Version: macOS-13.1-arm64-arm-64bit python: ['3.11.3 (main, Apr 7 2023, 20:13:31) [Clang 14.0.0 (clang-1400.0.29.202)]'] sklearn: 1.1.3 tensorflow: 2.13.0, devices:[PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU')] keras: 2.6.0 pytorch: 2.0.1 lightning: 2.0.5 darts: 0.24.0

Strategy Parameters/Flags

Dataset Type: DatasetType.DEFAULT (0) Signal Type: SignalType.MACD (macd) Classifier Type: ClassifierType.Transformer Lookahead: 1.0 hours (12 candles) n_profit_stddevs: 1.0 n_loss_stddevs: 1.0 compress_data: True refit_model: False model_per_pair: False combine_models: False ignore_exit_signals: False

BTC/USDT:USDT Compressed data 100 -> 64 (features) holds:22895 (88.32%) buys:1432 (5.52%) sells:1596 (6.16%) predicting buys/sells... Loading existing model (/Users/limore/quant_github/freqtrade_my/user_data/strategies/binance/models/NNTC_macd_Transformer/NNTC_macd_Transformer.h5)...

ETH/USDT:USDT Compressed data 100 -> 64 (features) holds:22818 (88.02%) buys:1465 (5.65%) sells:1640 (6.33%) predicting buys/sells... Epochs ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/100 0% • 0:00:11 • -:--:-- 2023-08-09 11:47:01,585 - freqtrade - ERROR - Fatal exception! joblib.externals.loky.process_executor._RemoteTraceback: """ Traceback (most recent call last): File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/externals/loky/process_executor.py", line 391, in _process_worker call_item = call_queue.get(block=True, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File @.**/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/queues.py", line 122, in get return _ForkingPickler.loads(res) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/externals/loky/cloudpickle_wrapper.py", line 43, in _reconstruct_wrapper obj = loads(_pickled_object) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/pickle_utils.py", line 48, in deserialize_model_from_bytecode raise e File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/pickle_utils.py", line 46, in deserialize_model_from_bytecode model = saving_lib.load_model(filepath, safe_mode=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/saving_lib.py", line 275, in load_model raise e File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/saving_lib.py", line 240, in load_model model = deserialize_keras_object( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/serialization_lib.py", line 710, in deserialize_keras_object instance.compile_from_config(compile_config) File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/engine/training.py", line 3582, in compile_from_config self.optimizer.build(self.trainable_variables) ^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/optimizers/legacy/optimizer_v2.py", line 997, in getattribute raise e File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/optimizers/legacy/optimizer_v2.py", line 987, in getattribute return super().getattribute*(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Adam' object has no attribute 'build' """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/limore/quant_github/freqtrade_new/freqtrade/main.py", line 42, in main return_code = args'func' http://args ^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/freqtrade/commands/optimize_commands.py", line 107, in start_hyperopt hyperopt.start() File "/Users/limore/quant_github/freqtrade_new/freqtrade/optimize/hyperopt.py", line 614, in start f_val = self.run_optimizer_parallel(parallel, asked) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/freqtrade/optimize/hyperopt.py", line 439, in run_optimizer_parallel return parallel(delayed( ^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/parallel.py", line 1098, in call self.retrieve() File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/parallel.py", line 975, in retrieve self._output.extend(job.get(timeout=self.timeout)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/_parallel_backends.py", line 567, in wrap_future_result return future.result(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File @./3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File @./3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception joblib.externals.loky.process_executor.BrokenProcessPool: A task has failed to un-serialize. Please ensure that the arguments of the function are all picklable.

please help me check it out ,thank you .

— Reply to this email directly, view it on GitHub https://github.com/nateemma/strategies/issues/35, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD4X5555SVDAILDYHDNTM3XUMCC3ANCNFSM6AAAAAA3JL7PIU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

nateemma commented 1 year ago

OK, so apparently this is a problem with tensorflow >=2.11 on Mac M1/M2 machines. It also appears you have an old version of keras.

The quick workaround is to downgrade to tensorflow2.10 (and upgrade keras), I'm looking into other solutions...

Thanks,

Phil

On Thu, Aug 17, 2023 at 8:23 AM Phil Price @.***> wrote:

I'm trying to chase this down. The problem is that 'something' is not pickle-able and hyperopt saves and reloads strategies a lot. The messages seem to indicate that this is related to a tensorflow object, so I'm going to try newer versions of tensorflow (and freqtrade) to see if this has been resolved

This is probably going to take a long time to resolve...

Thanks,

Phil

On Tue, Aug 8, 2023 at 8:49 PM Limore0129 @.***> wrote:

zsh user_data/strategies/scripts/hyp_strat.sh -n 90 -e 100 -l ExpectancyHyperOptLoss binance "NNTC_macd_Transformer"

Using config file: user_data/strategies/binance/config_binance.json and Strategy dir: user_data/strategies/binance

2023年 8月 9日 星期三 11时46分12秒 CST Optimising strategy:NNTC_macd_Transformer for exchange:binance...

freqtrade hyperopt --spaces sell --hyperopt-loss ExpectancyHyperOptLoss --timerange=20230511-20230809 --epochs 100 -c user_data/strategies/binance/config_binance.json --strategy-path user_data/strategies/binance -s NNTC_macd_Transformer --min-trades 45 --no-color

2023-08-09 11:46:14,869 - freqtrade - INFO - freqtrade 2023.6.dev-0b8ef1b88 2023-08-09 11:46:14,895 - freqtrade.configuration.load_config - INFO - Using config: user_data/strategies/binance/config_binance.json ... 2023-08-09 11:46:14,896 - freqtrade.loggers - INFO - Verbosity set to 0 2023-08-09 11:46:14,896 - freqtrade.configuration.configuration - INFO - Using additional Strategy lookup path: user_data/strategies/binance 2023-08-09 11:46:14,896 - freqtrade.configuration.configuration - INFO - Using max_open_trades: 10 ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter --timerange detected: 20230511-20230809 ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Using user-data directory: /Users/limore/quant_github/freqtrade_my/user_data ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Using data directory: /Users/limore/quant_github/freqtrade_my/user_data/data/binance ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter --epochs detected ... Will run Hyperopt with for 100 epochs ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter -s/--spaces detected: ['sell'] 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter --no-color detected ... 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter -j/--job-workers detected: -1 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Parameter --min-trades detected: 45 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Using Hyperopt loss class name: ExpectancyHyperOptLoss 2023-08-09 11:46:14,897 - freqtrade.configuration.configuration - INFO - Filter trades by timerange: 20230511-20230809 2023-08-09 11:46:14,897 - freqtrade.exchange.check_exchange - INFO - Checking exchange... 2023-08-09 11:46:14,900 - freqtrade.exchange.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade development team. 2023-08-09 11:46:14,900 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration. 2023-08-09 11:46:14,900 - freqtrade.configuration.config_validation - INFO - Validating configuration ... 2023-08-09 11:46:14,903 - freqtrade.commands.optimize_commands - INFO - Starting freqtrade in Hyperopt mode 2023-08-09 11:46:14,903 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled 2023-08-09 11:46:14,903 - freqtrade.exchange.exchange - INFO - Using CCXT 3.1.23 2023-08-09 11:46:14,903 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'options': {'defaultType': 'swap'}, 'aiohttp_proxy': 'http://127.0.0.1:7890', 'proxies': {'http': ' http://127.0.0.1:7890', 'https': 'http://127.0.0.1:7890'}} 2023-08-09 11:46:14,907 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'options': {'defaultType': 'swap'}, 'aiohttp_proxy': 'http://127.0.0.1:7890', 'proxies': {'http': ' http://127.0.0.1:7890', 'https': 'http://127.0.0.1:7890'}} 2023-08-09 11:46:14,910 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance" 2023-08-09 11:46:18,179 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange 'Binance'... 2023-08-09 11:46:22,143 - torch.distributed.nn.jit.instantiator - INFO - Created a temporary directory at /var/folders/0h/68ps0f690bz5xn7mk5_538h40000gp/T/tmp7gxwohvr 2023-08-09 11:46:22,143 - torch.distributed.nn.jit.instantiator - INFO - Writing /var/folders/0h/68ps0f690bz5xn7mk5_538h40000gp/T/tmp7gxwohvr/_remote_module_non_scriptable.py

NNTC_macd_Transformer

Software Environment:

freqtrade: 2023.6.dev-0b8ef1b88 OS Type: darwin (MacOS), Version: macOS-13.1-arm64-arm-64bit python: ['3.11.3 (main, Apr 7 2023, 20:13:31) [Clang 14.0.0 (clang-1400.0.29.202)]'] sklearn: 1.1.3 tensorflow: 2.13.0, devices:[PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU')] keras: 2.6.0 pytorch: 2.0.1 lightning: 2.0.5 darts: 0.24.0

Strategy Parameters/Flags

Dataset Type: DatasetType.DEFAULT (0) Signal Type: SignalType.MACD (macd) Classifier Type: ClassifierType.Transformer Lookahead: 1.0 hours (12 candles) n_profit_stddevs: 1.0 n_loss_stddevs: 1.0 compress_data: True refit_model: False model_per_pair: False combine_models: False ignore_exit_signals: False

BTC/USDT:USDT Compressed data 100 -> 64 (features) holds:22895 (88.32%) buys:1432 (5.52%) sells:1596 (6.16%) predicting buys/sells... Loading existing model (/Users/limore/quant_github/freqtrade_my/user_data/strategies/binance/models/NNTC_macd_Transformer/NNTC_macd_Transformer.h5)...

ETH/USDT:USDT Compressed data 100 -> 64 (features) holds:22818 (88.02%) buys:1465 (5.65%) sells:1640 (6.33%) predicting buys/sells... Epochs ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/100 0% • 0:00:11 • -:--:-- 2023-08-09 11:47:01,585 - freqtrade - ERROR - Fatal exception! joblib.externals.loky.process_executor._RemoteTraceback: """ Traceback (most recent call last): File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/externals/loky/process_executor.py", line 391, in _process_worker call_item = call_queue.get(block=True, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File @.**/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/queues.py", line 122, in get return _ForkingPickler.loads(res) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/externals/loky/cloudpickle_wrapper.py", line 43, in _reconstruct_wrapper obj = loads(_pickled_object) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/pickle_utils.py", line 48, in deserialize_model_from_bytecode raise e File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/pickle_utils.py", line 46, in deserialize_model_from_bytecode model = saving_lib.load_model(filepath, safe_mode=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/saving_lib.py", line 275, in load_model raise e File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/saving_lib.py", line 240, in load_model model = deserialize_keras_object( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/saving/serialization_lib.py", line 710, in deserialize_keras_object instance.compile_from_config(compile_config) File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/engine/training.py", line 3582, in compile_from_config self.optimizer.build(self.trainable_variables) ^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/optimizers/legacy/optimizer_v2.py", line 997, in getattribute raise e File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/keras/src/optimizers/legacy/optimizer_v2.py", line 987, in getattribute return super().getattribute*(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Adam' object has no attribute 'build' """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/limore/quant_github/freqtrade_new/freqtrade/main.py", line 42, in main return_code = args'func' http://args ^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/freqtrade/commands/optimize_commands.py", line 107, in start_hyperopt hyperopt.start() File "/Users/limore/quant_github/freqtrade_new/freqtrade/optimize/hyperopt.py", line 614, in start f_val = self.run_optimizer_parallel(parallel, asked) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/freqtrade/optimize/hyperopt.py", line 439, in run_optimizer_parallel return parallel(delayed( ^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/parallel.py", line 1098, in call self.retrieve() File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/parallel.py", line 975, in retrieve self._output.extend(job.get(timeout=self.timeout)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/limore/quant_github/freqtrade_new/.env/lib/python3.11/site-packages/joblib/_parallel_backends.py", line 567, in wrap_future_result return future.result(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File @./3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File @./3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception joblib.externals.loky.process_executor.BrokenProcessPool: A task has failed to un-serialize. Please ensure that the arguments of the function are all picklable.

please help me check it out ,thank you .

— Reply to this email directly, view it on GitHub https://github.com/nateemma/strategies/issues/35, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD4X5555SVDAILDYHDNTM3XUMCC3ANCNFSM6AAAAAA3JL7PIU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Limore0129 commented 1 year ago

what is your version,bro! I can't install tensorflow2.10 in mac M1 . @nateemma

nateemma commented 1 year ago

I'm struggling too (I assumed it would be easy). If I can't get it installed, I'll contact Matthias to see if he has any ideas, as it seems to be a fundamental issue of using pickle with tensorflow

Thanks,

Phil

On Tue, Aug 22, 2023 at 3:15 AM Limore0129 @.***> wrote:

what is your version,bro! I can't install tensorflow2.10 in mac M1 . @nateemma https://github.com/nateemma

— Reply to this email directly, view it on GitHub https://github.com/nateemma/strategies/issues/35#issuecomment-1687904110, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD4X57PTKXWOGNG47LER73XWSBD3ANCNFSM6AAAAAA3JL7PIU . You are receiving this because you were mentioned.Message ID: @.***>

Limore0129 commented 1 year ago

It seems that due to a macos issue, only versions after 2.11 can be installed,Please let me know if there is any progress. Thank you @nateemma