pytorch / pytorch

Tensors and Dynamic neural networks in Python with strong GPU acceleration
https://pytorch.org
Other
79.04k stars 21.3k forks source link

Update test_cuda.py and test_torch.py optim tests to use OptimizerInfo and optim_db #123451

Open janeyx99 opened 1 month ago

janeyx99 commented 1 month ago

🚀 The feature, motivation and pitch

Update: all tasks below have in progress PRs currently!

In test_cuda.py and test_torch.py, we have the following optimizer tests that should be migrated to use the new OptimizerInfo infrastructure. (See any of the tests in TestOptimRenewed for how to apply OptimizerInfos.) The basic structure to expect for an updated test will look like:

    @optims([optim for optim in optim_db if ...], dtypes=[torch.float32])
    def test_name(self, device, dtype, optim_info):
        optim_cls = optim_info.optim_cls
        optim_inputs = optim_info.optim_inputs_func(device=device)
        for optim_input in optim_inputs:
            params = ...
            // processing, like updating grads

            optimizer = optim_cls(params, ..., **optim_input.kwargs)

            // the actual test
            ...
            self.assertEquals(...)

test_cuda.py:

test_torch.py: #125538

Feel free to take up one or a subset of those tests to migrate--edit your username next to the checklist to claim an item to submit PRs for!

Alternatives

No response

Additional context

No response

cc @vincentqb @jbschlosser @albanD @crcrpar

rithikp06 commented 1 month ago

I'd like to work on this

janeyx99 commented 1 month ago

@rithikp06 feel free to claim a sub task (e.g., which tests are you migrating?) and open a PR!

rithikp06 commented 1 month ago

I'll work on the test_torch.py tests.

ComposeC commented 1 month ago

@janeyx99 I'd like to work on the test_grad_scaling_autocast_fused_optimizers function in test_cuda.py.

rithikp06 commented 1 month ago

I created a PR that addresses the test_torch.py part: https://github.com/pytorch/pytorch/pull/123537

FireACNC commented 1 month ago

I'd like to work on the test_graph_grad_scaling function in test_cuda.py.

jayanthd04 commented 1 month ago

Hi, I'm a first time contributor. I would like to work on test_graph_optims and test_graph_scaling_fused_optimizers. Could i get some pointer on where I could find more information about OptimizerInfo infrastructure and TestOptimRenewed?

dwang3851 commented 1 month ago

I'd like to work on the test_graph_optims_with_explicitly_capturable_param_groups function in test_cuda.py

khlaifiabilel commented 1 month ago

Greetings 👋 , This is very interesting I would like to work on the test_graph_optims in the test_cuda.py

janeyx99 commented 1 month ago

Hi, I'm a first time contributor. I would like to work on test_graph_optims and test_graph_scaling_fused_optimizers. Could i get some pointer on where I could find more information about OptimizerInfo infrastructure and TestOptimRenewed?

TestOptimRenewed is a class full of tests that use the OptimizerInfo infrastructure: https://github.com/pytorch/pytorch/blob/main/test/test_optim.py#L44

The OptimizerInfo infrastructure is defined in common_optimizers.py, you would want to search for optims_db and OptimizerInfo for what they are. I think looking at an existing test (any of the ones in TestOptimRenewed) would give a good highlevel of how these are used.

julian-8897 commented 1 month ago

HI there, I'm a first time contributor here :). I would like to work on the test for _grad_scaling_autocast_test under test_torch.py

PetaBread545 commented 1 month ago

Hello, I am also a first time contributor. Seeing that #123537 already addresses the test_py subtasks, I would like to work on the test_cuda subtasks.

dwang3851 commented 1 month ago

Hi, I'm a first time contributor working on this issue. Is there any way to approve Github workflows for me on the pr above, I was hoping to make sure those results matched my local results?

omastey commented 1 month ago

Hi, I have begun working on this ticket, are there any specs or documentation I could look at?

Rbhu376264 commented 1 month ago

Hello There, Hope this message finds you well!!! I am a newbie to open-source contribution, and would really like to get some advice how to get started in contributing "test_graph_scaling_fused_optimizers" . How can I get started on this? Any suggestions would be highly appreciated!!!

janeyx99 commented 1 week ago

not done yet