Replies: 1 comment
-
Hi @saish23 , Can you please show me the code of Is it the same code as the course? def set_seeds(seed: int=42):
"""Sets random sets for torch operations.
Args:
seed (int, optional): Random seed to set. Defaults to 42.
"""
# Set the seed for general torch operations
torch.manual_seed(seed)
# Set the seed for CUDA torch operations (ones that happen on the GPU)
torch.cuda.manual_seed(seed) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am getting this error below because of which I am unable to run the whole code. Error is encountered when I am calling this set_seed() a function that is copied below. Kindly help me with this. Thanks in advance.
AttributeError Traceback (most recent call last)
in <cell line: 7>()
5 # Since we're creating a new layer with random weights (torch.nn.Linear),
6 # let's set the seeds
----> 7 set_seeds()
8
9 # Update the classifier head to suit our problem
2 frames
/usr/local/lib/python3.10/dist-packages/torch/mps/init.py in manual_seed(seed)
50 # sure mps is available (otherwise we just return without
51 # erroring out)
---> 52 if not torch._C._has_mps:
53 return
54 seed = int(seed)
AttributeError: module 'torch._C' has no attribute '_has_mps'
Beta Was this translation helpful? Give feedback.
All reactions