Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot Game Engine TorchSharp Environment #1032

Closed
GeorgeS2019 opened this issue Jun 30, 2023 · 14 comments
Closed

Godot Game Engine TorchSharp Environment #1032

GeorgeS2019 opened this issue Jun 30, 2023 · 14 comments

Comments

@GeorgeS2019
Copy link

This is WIP to figure out how to configure TorchSharp environment in Godot .NET6/7 environment
If anyone has experience, please share.

image

@NiklasGustafsson
Copy link
Contributor

Is this an issue or a discussion? What specific action are you looking for from the maintainers?

@GeorgeS2019
Copy link
Author

GeorgeS2019 commented Jun 30, 2023

I solve the problem. Create issue for future Godot users coming to TorchSharp

  <ItemGroup>
    <PackageReference Include="libtorch-cuda-11.7-win-x64" Version="2.0.1.1" />
    <PackageReference Include="TorchSharp" Version="0.100.3" />
  </ItemGroup>

@NiklasGustafsson
Copy link
Contributor

As mentioned high up on the README page:

We recommend using one of the 'bundled' packages: TorchSharp-cpu, TorchSharp-cuda-windows, or TorchSharp-cuda-linux. They will pull in the right libtorch backends.

@GeorgeS2019
Copy link
Author

@NiklasGustafsson
I tried, so as @ChengYen-Tang
It does not work with Godot. It will take some time to investigate

@michieal
Copy link

okay, this kinda begs the question -- Godot builds for different platforms. Which one does one use (the package) for something like that?

@NiklasGustafsson
Copy link
Contributor

The question of platform is (unfortunately) tied to libtorch as well as TorchSharp.

libtorch supports Windows x64, Linux x64, Linux ARM64, MacOS x64, MacOS M1. You can supposedly build it from source for other platforms, per my understanding. Of these, we haven't tested TorchSharp with Linux ARM or MacOS M1 (because I don't have the hardware for either).

@GeorgeS2019
Copy link
Author

@NiklasGustafsson
Should I write a formal request to ask Microsoft allocate these hardware for you ☺️

@NiklasGustafsson
Copy link
Contributor

@NiklasGustafsson Should I write a formal request to ask Microsoft allocate these hardware for you ☺️

No, thanks! :-)

@GeorgeS2019
Copy link
Author

@NiklasGustafsson
I recently wrote a long email to someone why TorchSharp is important to Deep AI for 3D game engine like Godot with MIT license and ranked 8th in the entire GitHub universe.

@michieal
Copy link

The question of platform is (unfortunately) tied to libtorch as well as TorchSharp.

libtorch supports Windows x64, Linux x64, Linux ARM64, MacOS x64, MacOS M1. You can supposedly build it from source for other platforms, per my understanding. Of these, we haven't tested TorchSharp with Linux ARM or MacOS M1 (because I don't have the hardware for either).

So, different projects for different build platforms.
And, I understand the whole "don't have the hardware" aspect.

@NiklasGustafsson
Copy link
Contributor

NiklasGustafsson commented Oct 20, 2023

Not quite -- the TorchSharp-cpu package pulls in Windows/Linux/MacOS x64, so for those, you don't have to do anything special. If you need a CUDA backend, it's different. They are huge (2-3GB), so we don't pull them in by default.

@michieal
Copy link

okay, cool.
And, I wouldn't do the CUDA one as it's not guaranteed that the end user will have an Nvidia card, or ROCm drivers that would support it. That, and depending on the user's video card to run something like that, with it having full graphics, is pushing it. So... I would just use the CPU one.

Also, I saw that llama.cpp (github project) has a PR (at the time I saw it) that made use of the nmap? c++ command that allows the model files to be mapped as memory space (like a dedicated swap file) and I was wondering if TorchSharp has something like that or could work with something created in c# to do that?

(Probably should have asked that on a different topic/issue. my bad)

@NiklasGustafsson
Copy link
Contributor

Yeah, turn that into a feature request...

@michieal
Copy link

Yeah, turn that into a feature request...

#1120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants