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: A terminal spreadsheet editor with Vim keybindings
Show HN: A terminal spreadsheet editor with Vim keybindings While speccing out this spreadsheet tool, I realized that I never had to think about the keybindings. It all just came naturally from Vim. Normal/insert/visual modes, hjkl navigation, dd/yy/p, :w, :q. The usual muscle memory works.<p>It supports CSV/TSV import and export, and a native .cell format that preserves formulas. The formula engine handles SUM, AVERAGE, COUNT, MIN, MAX, and IF with range references.<p>The codebase is a Cargo workspace: a pure cell-sheet-core library (no TUI dependency) and a cell-sheet-tui crate on top of ratatui. Early days, but it's usable.<p>To try it out: cargo install cell-sheet-tui<p>Feedback of any kind is greatly appreciated!
No other tools from this source yet.