Skip to content

The code no longer works #3

@robintux

Description

@robintux

Add a line to have the utils.py file in my notebook (Google Colaboratory). I'm trying to be able to execute the first cell of code in the file: PythonLambdaExpressionFitting.ipynb

%matplotlib inline
import matplotlib.pyplot as plt
from IPython.display import display, Markdown, Latex

import numpy as np
import math, random
import pandas as pd

from tqdm import tqdm

import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.nn.init as init
import torch.utils.data
import torch.optim 
from torch.optim import lr_scheduler

from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import LabelEncoder
from scipy.signal import gausspulse

!wget https://raw.githubusercontent.com/thomberg1/UniversalFunctionApproximation/refs/heads/master/utils.py
from utils import *

I get the following error message in the traceback :

Traceback (most recent call last):

  File "/usr/local/lib/python3.12/dist-packages/IPython/core/interactiveshell.py", line 3553, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "/tmp/ipython-input-3937942861.py", line 25, in <cell line: 0>
    from utils import *

  File "/content/utils.py", line 67
    def to_var(x, async=False):
                  ^
SyntaxError: invalid syntax

I am working with a T4 instance

I understand that the problem might be because async is a reserved word (keyword ), but I'd like to know what you think of this report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions