Replies: 4 comments
-
My codeI try to turn To load in a saved state_dict we have to instantiate a new instance of our model classloaded_model_0 = LinearRegressionModel() Load the saved state_dict of model_0 (this will update the new instance with updated parameters)loaded_model_0.load_state_dict(torch.load(f=MODEL_SAVE_PATH)) |
Beta Was this translation helpful? Give feedback.
-
My errorTODO: Add some info here about your error... My codeTODO: Add your code here, best to format with backticks as well, for example: def forward(self, x: torch.Tensor): Put model into training modemodel.train() Add a loop to loop through the training batchesfor batch, (X, y) in enumerate(data_loader):
Divide total train loss and acc by length of train dataloadertrain_loss /= len(data_loader) ```python <- use triple backticks before and after your code, write "python" after the first set to make the code formatted What I've tried so farwhy can use the ReLU in output, what it's funtion? |
Beta Was this translation helpful? Give feedback.
-
Hi Daniel, I'm having problems with pytorch versions because I'm using the torch-2.1.1 torchvision-0.16.1 packages and the codes in the tutorial don't really work. Would you like to help me fix it? |
Beta Was this translation helpful? Give feedback.
-
I followed this video, code is exactly same but when i am trying this chunk of code, torch.manual_seed(42)An Epoch is one loop through the data...epochs = 1 TRAINING LOOPStep 0 >> Loop through the datafor epoch in range(epochs): Step 1 >> fORWARD PASSy_pred = model_0(X_train) Step 2 >> CALCULATE THE LOSSloss = loss_fn( y_pred, y_train ) Step 3 >> OPTIMIZER ZERO GRADoptimizer.zero_grad() Step 4 >> PERFORM BACKPROPAGATION ON THE LOSS WITH RESPECT TO THE PARAMETERS OF THE MODELloss.backward() Step 5 >> STEP THE OPTIMIZER (PERFORMS GRADIENT DESCENT)optimizer.step() ///////////////////////////////////////////////////////////////// i get error on this line, RuntimeError: Boolean value of Tensor with more than one value is ambiguous I am new learner, kindly help me where is the mistake and how to fix it |
Beta Was this translation helpful? Give feedback.
-
This template is to help with the formatting of questions to best help others who are reading it.
The four main sections are:
You can copy the demo template below and fill out the sections in your question, much of the formatting has been done just to make things look nicer:
Beta Was this translation helpful? Give feedback.
All reactions