In the instances where I’ve needed to run inference in the browser I have used Onnx runtime web to run weights that were exported from PyTorch training. You have to convert your browser data to onnx tensors, but it’s not that bad.
I don’t do actual training in the browser though, so maybe someone else can answer that part.