Skip to content

Seastar unable to accumulate gradients #3

@JoelMathewC

Description

@JoelMathewC

When trying to accumulate gradients in the manner shown below a runtime error occurs.

print("Training...\n")
    model.train()
    for epoch in tqdm(range(args.num_epochs)):
        cost = 0
        hidden_state = None
        optimizer.zero_grad()
        for index in range(train_features.shape[0]):
            print("🔴 Index: {}".format(index))
            # y_hat, hidden_state = model(G, features, edge_weights, hidden_state)
            y_hat = model(train_features[index], edge_weights)
            cost = cost + torch.mean((y_hat-train_targets[index])**2)
        cost = cost / (index+1)
        cost.backward()
        optimizer.step()

The runtime error raised is as follows

File "/usr/local/lib/python3.8/dist-packages/seastar-0.1-py3.8.egg/seastar/executor.py", line 269, in <listcomp>
    ret = tuple([self.ts.tensor_map[grad.id] if grad != None else None for grad in arg_grads] + [None for grad in ret_grads])
KeyError: 'V9'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions