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

Implement batching #157

Open
jwallwork23 opened this issue Jul 12, 2024 · 4 comments
Open

Implement batching #157

jwallwork23 opened this issue Jul 12, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request hackathon

Comments

@jwallwork23
Copy link
Contributor

When we run examples/1_SimpleNet/simplenet.py, the final thing that's executed is effectively

a = [0.0, 1.0, 2.0, 3.0, 4.0]
model(torch.Tensor(a))

This would also work with batching e.g.,

a = [0.0, 1.0, 2.0, 3.0, 4.0]
model(torch.Tensor([a, a]))

We should enable calling batching in this way on the FTorch side, too.

@jwallwork23 jwallwork23 added enhancement New feature or request hackathon labels Jul 12, 2024
@jwallwork23
Copy link
Contributor Author

jwallwork23 commented Jul 29, 2024

To investigate: is Torch underneath smart enough to do this, or will we have to loop?

@jatkinson1000
Copy link
Member

It would still be good to implement this on the FTorch side, but worth noting that batching can be incorporated into the pytorch side (to then take arbitrary sized (in one dimension) Fortran arrays) with a little thought and care.

This is what was done for MiMA here: https://github.com/DataWaveProject/MiMA-machine-learning/blob/ML/src/shared/pytorch/arch_davenet.py Though it is not the easiest to follow.

@jwallwork23
Copy link
Contributor Author

Might still be worth comparing performance between implementing this on the Fortran side vs Torch.

@dorchard
Copy link
Member

I started experimenting with how FTorch behaves, trying to emulate taking a list of vectors, on this branch: https://github.com/Cambridge-ICCS/FTorch/tree/batching
[work in progress]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hackathon
Projects
None yet
Development

No branches or pull requests

3 participants