#๐Ÿ”’ PyTorch different results locally vs. cluster

7 messages ยท Page 1 of 1 (latest)

misty crystal
#

Hello,

I implement a fancy non-backpropagation based approach to deep learning with PyTorch and try to solve XOR. It's rather simple. I guess the theoretical details don't matter. I have three files: run_XOR.py, networks.py and data.py. I have two torch models, one is very classical the other the fancy one whereas teh classical generates a "signal" to control the other one. Anyway, that shouldn't really matter much.

I try to solve a continual learning problem on XOR with that. So I have output like this:

Task 1 - Performance on Task 1: 50.00%
Task 2 - Performance on Task 1: 50.00%
Task 2 - Performance on Task 2: 50.00%
Task 3 - Performance on Task 1: 50.00%
Task 3 - Performance on Task 2: 50.00%
Task 3 - Performance on Task 3: 50.00%

First task 1, then we train on task 2 but also try to solve task 1, same with task 3. The problem now is that if I run python run_XOR.py on my cluster vs. locally, I get different performances. I use optuna to search for the hyperparameters.

Optuna should be implemented ocrrectly. I only use it on a single core because sqlite doesn't support parallelism. I checked the results optuna provides and that works (locally reps. on teh cluster)

Now if I run the experiment for a certain set of paramteres locally, I get different results on my cluster and I don't know why.

inside run_XOR.py I have a function run_experiment() that does:

    torch.manual_seed(seed)
    np.random.seed(seed)
    random.seed(seed)

Then inside data.py I also fix the shuffling of the data:

def get_dataloader(task_id, batch_size=32, seed=0):
    dataset = ContinualLearningDataset(task_id)
    sampler = RandomSampler(dataset, generator=torch.Generator().manual_seed(seed))
    return DataLoader(dataset, batch_size=batch_size, sampler=sampler, shuffle=False)
  • I also use torch.randn_like to generate data but that should should the fixed seed.
  • I don't init weights of models.
  • I don't do anything in parallel.
unique barnBOT
#

@misty crystal

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

misty crystal
#

what else could it be?

broken fjord
#

like a function named something along the lines of that
turn it on

unique barnBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.