Hi!
Sorry if I say anything wrong or with a very obvious solution, I am a beginner.
I am trying to replicate your code without changes, with a .pkl data file of my own, so I'm running python=3.10, pytorch-lightning=1.8.5 and traffic=2.8.0, because with the latest version of traffic some modules have changed or dissapeared, such as traffic.core.projection.
But in this enviroment, when running the command:
python generation.py my_pickle_datafile.pkl version_0 version_1
it turns out that from lines with traffic.data.columns which are in scripts traffic.py and datasets.py I get the error " 'Traffic' object has no attribute 'columns' ", which I don't understand, as t.data is supposed to be a pd.DataFrame, and it works well in traffic 2.9.0.
This is the traceback error log:
(traffic_deep) C:\Users\alejandro.lema\Desktop\Tareas\5 nuevos desarrollos\Trayectorias Sintéticas\deep_traffic_generation_github\code>python generation.py traffic_gcts_sample.pkl version_0 version_1
C:\ProgramData\anaconda3\envs\traffic_deep\lib\site-packages\torchvision\io\image.py:13: UserWarning: Failed to load image Python extension: '[WinError 127] No se encontró el proceso especificado'If you don't plan on using image functionality from `torchvision.io`, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have `libjpeg` or `libpng` installed before building `torchvision` from source?
warn(
Loading VAEs...
<class 'traffic.core.traffic.Traffic'>
Traceback (most recent call last):
File "C:\Users\alejandro.lema\Desktop\Tareas\5 nuevos desarrollos\Trayectorias Sintéticas\deep_traffic_generation_github\code\generation.py", line 266, in <module>
main()
File "C:\ProgramData\anaconda3\envs\traffic_deep\lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "C:\ProgramData\anaconda3\envs\traffic_deep\lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "C:\ProgramData\anaconda3\envs\traffic_deep\lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\ProgramData\anaconda3\envs\traffic_deep\lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "C:\Users\alejandro.lema\Desktop\Tareas\5 nuevos desarrollos\Trayectorias Sintéticas\deep_traffic_generation_github\code\generation.py", line 243, in main
dataset_fcvae, dataset_tcvae, t_fcvae, t_tcvae, g_fcvae, g_tcvae = loading(training_name, fcvae_version, tcvae_version)
File "C:\Users\alejandro.lema\Desktop\Tareas\5 nuevos desarrollos\Trayectorias Sintéticas\deep_traffic_generation_github\code\generation.py", line 40, in loading
dataset_fcvae = TrafficDataset.from_file(
File "C:\Users\alejandro.lema\Desktop\Tareas\5 nuevos desarrollos\Trayectorias Sintéticas\deep_traffic_generation_github\code\deep_traffic_generation\core\datasets.py", line 144, in from_file
dataset = cls(traffic, features, shape, scaler, info_params)
File "C:\Users\alejandro.lema\Desktop\Tareas\5 nuevos desarrollos\Trayectorias Sintéticas\deep_traffic_generation_github\code\deep_traffic_generation\core\datasets.py", line 91, in __init__
list(f.data[self.features].values.ravel() for f in traffic)
File "C:\Users\alejandro.lema\Desktop\Tareas\5 nuevos desarrollos\Trayectorias Sintéticas\deep_traffic_generation_github\code\deep_traffic_generation\core\datasets.py", line 91, in <genexpr>
list(f.data[self.features].values.ravel() for f in traffic)
File "C:\ProgramData\anaconda3\envs\traffic_deep\lib\site-packages\traffic\core\traffic.py", line 414, in __iter__
yield from self.iterate()
File "C:\ProgramData\anaconda3\envs\traffic_deep\lib\site-packages\traffic\core\traffic.py", line 366, in iterate
if "flight_id" in self.data.columns:
AttributeError: 'Traffic' object has no attribute 'columns'
I do have gone through all the logs tracking the error, but I just can't find the reason why it says that a traffic.data object is a Traffic object instead of a pd.DataFrame!!! :(
Trying to track the error root, I came up with this issue:
Traceback (most recent call last):
Cell In[8], line 8
dataset_fcvae = TrafficDataset.from_file(
File C:\Users\alejandro.lema\Desktop\Tareas\5 nuevos desarrollos\Trayectorias Sintéticas\deep_traffic_generation_github\code\deep_traffic_generation\core\datasets.py:140 in from_file
traffic = Traffic.from_file(file_path)
File C:\ProgramData\anaconda3\envs\traffic_deep\lib\site-packages\traffic\core\traffic.py:126 in from_file
tentative = super().from_file(filename, **kwargs)
File C:\ProgramData\anaconda3\envs\traffic_deep\lib\site-packages\traffic\core\mixins.py:86 in from_file
return cls(pd.read_pickle(path, **kwargs))
File C:\ProgramData\anaconda3\envs\traffic_deep\lib\site-packages\traffic\core\mixins.py:53 in init
self.data: pd.DataFrame = data # type: ignore
TypeError: descriptor 'data' for 'Traffic' objects doesn't apply to a 'Traffic' object
I have no idea why this happends, in mixins.py. Are "2 different Traffic classes" getting mixed up?
Or why is happening that traffic.data is still a Traffic object, and so it produces this error in mixins.py? I am so lost...
I am not too familiarized with class coding, I'm trying but I can't figure out what's wrong.
Could you please advice?
Thanks a lot!!
Kind regards