Show HN: Run PyTorch locally with a remote GPU backend
Show HN (score: 5)Description
machine = mycelya_torch.RemoteMachine("modal", "A100")
cuda_device = machine.device("cuda")
x = torch.randn(1000, 1000, device=cuda_device)
y = torch.randn(1000, 1000).to(cuda_device)
I made it reasonably performant by having most operations dispatch asynchronously whenever possible. For cases where slow performance is unavoidable such as uploading many GB of weights onto the GPU, I added a decorator that can be applied to functions to turn it into a remotely executed function. For the most part, the function should behave the same with or without the decorator; the main difference is whether the function code is executed locally or remotely. import mycelya_torch
from transformers import AutoModelForCausalLM, AutoTokenizer
@mycelya_torch.remote
def load_model(model_name: str):
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name, torch_dtype="auto", device_map="auto"
)
return model, tokenizer
You can only use it with Modal as the cloud provider right now, and it's free to use with their free monthly credits. I appreciate any feedback and bug reports :)More from Show
Show HN: Widen – Open-source Mac Postgres GUI with local or cloud text-to-SQL
Show HN: Widen – Open-source Mac Postgres GUI with local or cloud text-to-SQL Github: <a href="https://github.com/betocmn/widen" rel="nofollow">https://github.com/betocmn/widen</a><p>I was paying for DataGrip for several years as my desktop database GUI but if I wanted text-to-SQL with LLMs I'd have to pay even more on top. So I decided to build my own and I've been using it for a few weeks now.<p>At any time I'm usually working with 3 to 6 databases, and having them set up in something like Conductor (for parallel agentic coding), but for Postgres databases, lets me quickly start a session, ask questions to my database in plain English, get a data export, move on and close the session. It's been working well and I thought I would share it here.<p>It's a native Mac app (Swift), free and open source (MIT). For the LLM you bring your own OpenRouter key, or there's an experimental on-device mode using Apple's local model, where nothing leaves your Mac. Cloud mode only sends the question and schema metadata, not your data, unless you explicitly turn that on per connection.
Show HN: Play SNES, gba, in your terminal, even in tmux
Show HN: Play SNES, gba, in your terminal, even in tmux rom is a ~5k-line C libretro frontend that plays games in the terminal. It renders native pixels with the kitty graphics protocol in Ghostty or kitty, inline! even in tmux!<p>Nine platforms: SNES, NES, GB/GBC, GBA, Genesis, PC Engine, N64, Doom/Heretic/Hexen, Wolfenstein. macOS and Linux, MIT.<p><a href="https://github.com/jhickner/rom" rel="nofollow">https://github.com/jhickner/rom</a>
No other tools from this source yet.