Tim-Salzmann / l4casadi

Use PyTorch Models with CasADi for data-driven optimization or learning-based optimal control. Supports Acados.
MIT License
350 stars 23 forks source link

liblearned_dyn.so uses absolute path for .pt file – Allow Relative Path or Input Argument #16

Closed merdan-9 closed 11 months ago

merdan-9 commented 11 months ago

I've encountered a challenge with liblearned_dyn.so where it seems to open the .pt file using an absolute (global) path. This poses an issue when the project is used across different PCs where directory structures might differ.

Possible Solution: Modify the library to accept the .pt file path as an input argument. Or, implement support for relative paths to ensure the .pt file is located correctly. Any advice or practical solutions would be greatly appreciated!

Tim-Salzmann commented 11 months ago

Hi Merdan,

I see the problem and added the following parameter to L4CasADi, which lets you set the expected relative or absolute path of the models:

https://github.com/Tim-Salzmann/l4casadi/blob/c5390c302e0aa31103be078d9c6fe9b27a391e5a/l4casadi/l4casadi.py#L35-L38

Let me know if this solves your problem.

Best Tim

merdan-9 commented 11 months ago

Hi Tim,

Thank you for your swift response!

Best regards, Merdan