TFB icon indicating copy to clipboard operation
TFB copied to clipboard

json problem in pycharm

Open jahaur1 opened this issue 8 months ago • 2 comments

If I directly run the last line of code in the.sh file in the pycharm terminal.Such as python ./scripts/run_benchmark.py --config-path "rolling_forecast_config.json" --data-name-list "ETTh1.csv" --strategy-args '{"horizon": 720}' --model-name "time_series_library.DLinear" --model-hyper-params '{"batch_size": 64, "d_ff": 2048, "d_model": 512, "factor": 3, "horizon": 720, "norm": true, "period_len": 24, "seq_len": 336, "station_lr": 0.0001}' --adapter "transformer_adapter" --gpus 0 --num-workers 1 --timeout 60000 --save-path "ETTh1/DLinear"

Traceback (most recent call last): File "./scripts/run_benchmark.py", line 81, in build_model_config hyper_params = json.loads(model_hyper_params) File "E:\anaconda3\envs\pytorch\lib\json_init_.py", line 357, in loads return _default_decoder.decode(s) File "E:\anaconda3\envs\pytorch\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "E:\anaconda3\envs\pytorch\lib\json\decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

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

Traceback (most recent call last): File "./scripts/run_benchmark.py", line 343, in model_config = build_model_config(args, config_data) File "./scripts/run_benchmark.py", line 83, in build_model_config raise ValueError(f"Invalid JSON in model_hyper_params: {model_hyper_params}") from e ValueError: Invalid JSON in model_hyper_params: {batch_size: 64, d_ff: 2048, d_model: 512, factor: 3, horizon: 720, norm: true, period_len: 24, seq_len: 336, station_lr: 0.0001}

Then I made modifications to it based on your recommendation.Change the input code to python ./scripts/run_benchmark.py --config-path "rolling_forecast_config.json" --data-name-list "ETTh1.csv" --strategy-args "{"horizon": 720}" --model-name "time_series_library.DLinear" --model-hyper-params "{"batch_size": 64, "d_ff": 2048, "d_model": 512, "factor": 3, "horizon": 720, "norm": true, "period_len": 24, "seq_len": 336, "station_lr": 0.0001}" --adapter "transformer_adapter" --gpus 0 --num-workers 1 --timeout 60000 --save-path "ETTh1/DLinear"

usage: run_benchmark.py [-h] --config-path CONFIG_PATH [--data-name-list DATA_NAME_LIST [DATA_NAME_LIST ...]] [--data-set-name DATA_SET_NAME [DATA_SET_NAME ...]] [--adapter ADAPTER [ADAPTER ...]] --model-name MODEL_NAME [MODEL_NAME ...] [--model-hyper-params MODEL_HYPER_PARAMS [MODEL_HYPER_PARAMS ...]] [--metrics METRICS [METRICS ...]] [--strategy-args STRATEGY_ARGS] [--seed SEED] [--deterministic {full,efficient,none}] [--eval-backend {sequential,ray}] [--num-cpus NUM_CPUS] [--gpus GPUS [GPUS ...]] [--num-workers NUM_WORKERS] [--timeout TIMEOUT] [--max-tasks-per-child MAX_TASKS_PER_CHILD] [--aggregate_type AGGREGATE_TYPE] [--report-method {dash,csv}] [--save-path SAVE_PATH] [--save-true-pred SAVE_TRUE_PRED] run_benchmark.py: error: unrecognized arguments: horizon: 720}

SO, I used the same way as before and directly ran run_beachmark.py by setting default

I modified it to default=['{"batch_size": 64, "d_ff": 2048, "d_model": 512, "factor": 3, "horizon": 720, "norm": true, "period_len": 24, "seq_len": 336, "station_lr": 0.0001}'], and parser.add_argument( "--gpus", type=int, nargs="+", default=[0], help="List of gpu devices to use, only available in ray backends", )

BUT I GET A NEW QUESTION:

2025-05-14 20:05:00 [INFO] ts_benchmark.data.data_source(124): Start loading 8 series in parallel Traceback (most recent call last): File "C:\Users\jahau\Desktop\channel_model\TFB-master\scripts\run_benchmark.py", line 360, in log_filenames = pipeline( File "C:\Users\jahau\Desktop\channel_model\TFB-master\ts_benchmark\pipeline.py", line 134, in pipeline data_src.load_series_list(data_name_list) File "C:\Users\jahau\Desktop\channel_model\TFB-master\ts_benchmark\data\data_source.py", line 132, in load_series_list data_dict[series_name] = future.result() File "E:\anaconda3\envs\pytorch\lib\concurrent\futures_base.py", line 437, in result return self.__get_result() File "E:\anaconda3\envs\pytorch\lib\concurrent\futures_base.py", line 389, in __get_result raise self._exception File "E:\anaconda3\envs\pytorch\lib\concurrent\futures\thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "C:\Users\jahau\Desktop\channel_model\TFB-master\ts_benchmark\data\data_source.py", line 152, in _load_series data = read_data(datafile_path) File "C:\Users\jahau\Desktop\channel_model\TFB-master\ts_benchmark\data\utils.py", line 134, in read_data data = pd.read_csv(path) File "E:\anaconda3\envs\pytorch\lib\site-packages\pandas\io\parsers\readers.py", line 912, in read_csv return _read(filepath_or_buffer, kwds) File "E:\anaconda3\envs\pytorch\lib\site-packages\pandas\io\parsers\readers.py", line 577, in _read parser = TextFileReader(filepath_or_buffer, **kwds) File "E:\anaconda3\envs\pytorch\lib\site-packages\pandas\io\parsers\readers.py", line 1407, in init self._engine = self._make_engine(f, self.engine) File "E:\anaconda3\envs\pytorch\lib\site-packages\pandas\io\parsers\readers.py", line 1661, in _make_engine self.handles = get_handle( File "E:\anaconda3\envs\pytorch\lib\site-packages\pandas\io\common.py", line 859, in get_handle handle = open( FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\jahau\Desktop\channel_model\TFB-master\dataset\forecasting\1'

When searching for the Etth1.csv file, it turned out to be done by individual characters

jahaur1 avatar May 14 '25 12:05 jahaur1

I debugged and the 'args' were correct. I don't know how it happened Namespace(adapter=['t', 'r', 'a', 'n', 's', 'f', 'o', 'r', 'm', 'e', 'r', '_', 'a', 'd', 'a', 'p', 't', 'e', 'r', None, None, None, None, None, None, None, None], aggregate_type='mean', config_path='rolling_forecast_config.json', data_name_list='ETTh1.csv', data_set_name=None, deterministic='efficient', eval_backend='sequential', gpus=[0], max_tasks_per_child=100, metrics=None, model_hyper_params=['{"batch_size": 64, "d_ff": 2048, "d_model": 512, "factor": 3, "horizon": 720, "norm": true, "period_len": 24, "seq_len": 336, "station_lr": 0.0001}', None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None], model_name='time_series_library.DLinear', num_cpus=12, num_workers=1, report_method='csv', save_path='ETTh1/DLinear', save_true_pred=None, seed=None, strategy_args='{"horizon": 720}', timeout=60000)

jahaur1 avatar May 14 '25 12:05 jahaur1

Thank you for your attention and question. My apologies for the delayed response.

May I ask if you're using Windows or Mac? You can check the 'How to use PyCharm to run code' section in the README's FAQ.

qiu69 avatar May 25 '25 09:05 qiu69

I use in windows,could you enrich 'How to use PyCharm to run code' section?

jahaur1 avatar May 27 '25 09:05 jahaur1

Perhaps you can learn more about the differences between different terminals on the internet yourself.

You can try "git bash".

qiu69 avatar May 27 '25 14:05 qiu69

If there are no other questions, I will end this issue. If you have any questions, please feel free to open a new issue for communication!

qiu69 avatar Jun 13 '25 09:06 qiu69