diff --git a/donkeycar/__init__.py b/donkeycar/__init__.py index aae7c9c76..8011dee56 100644 --- a/donkeycar/__init__.py +++ b/donkeycar/__init__.py @@ -3,7 +3,7 @@ from pyfiglet import Figlet import logging -__version__ = '5.1.dev1' +__version__ = '5.1.dev2' logging.basicConfig(level=os.environ.get('LOGLEVEL', 'INFO').upper()) diff --git a/donkeycar/management/kivy_ui.py b/donkeycar/management/kivy_ui.py index 6842ccaf3..8a42c2245 100644 --- a/donkeycar/management/kivy_ui.py +++ b/donkeycar/management/kivy_ui.py @@ -148,7 +148,7 @@ def read_file(self): Logger.info(f'Donkeyrc: Donkey file {self.file_path} loaded.') return data else: - Logger.warn(f'Donkeyrc: Donkey file {self.file_path} does not ' + Logger.warning(f'Donkeyrc: Donkey file {self.file_path} does not ' f'exist.') return {} diff --git a/donkeycar/parts/actuator.py b/donkeycar/parts/actuator.py index fdf761a74..848feebc3 100644 --- a/donkeycar/parts/actuator.py +++ b/donkeycar/parts/actuator.py @@ -18,7 +18,7 @@ try: import RPi.GPIO as GPIO except ImportError as e: - logger.warn(f"RPi.GPIO was not imported. {e}") + logger.warning(f"RPi.GPIO was not imported. {e}") globals()["GPIO"] = None from donkeycar.parts.pins import OutputPin, PwmPin, PinState @@ -800,10 +800,10 @@ def run(self, throttle:float) -> None: where 1 is full forward and -1 is full backwards. """ if throttle is None: - logger.warn("TwoWheelSteeringThrottle throttle is None") + logger.warning("TwoWheelSteeringThrottle throttle is None") return if throttle > 1 or throttle < -1: - logger.warn( f"TwoWheelSteeringThrottle throttle is {throttle}, but it must be between 1(forward) and -1(reverse)") + logger.warning( f"TwoWheelSteeringThrottle throttle is {throttle}, but it must be between 1(forward) and -1(reverse)") throttle = clamp(throttle, -1, 1) self.speed = throttle @@ -843,16 +843,16 @@ def run(self, throttle:float, steering:float) -> Tuple[float, float]: where 1 is full forward and -1 is full backwards. """ if throttle is None: - logger.warn("TwoWheelSteeringThrottle throttle is None") + logger.warning("TwoWheelSteeringThrottle throttle is None") return if steering is None: - logger.warn("TwoWheelSteeringThrottle steering is None") + logger.warning("TwoWheelSteeringThrottle steering is None") return if throttle > 1 or throttle < -1: - logger.warn( f"TwoWheelSteeringThrottle throttle is {throttle}, but it must be between 1(forward) and -1(reverse)") + logger.warning( f"TwoWheelSteeringThrottle throttle is {throttle}, but it must be between 1(forward) and -1(reverse)") throttle = clamp(throttle, -1, 1) if steering > 1 or steering < -1: - logger.warn( f"TwoWheelSteeringThrottle steering is {steering}, but it must be between 1(right) and -1(left)") + logger.warning( f"TwoWheelSteeringThrottle steering is {steering}, but it must be between 1(right) and -1(left)") steering = clamp(steering, -1, 1) left_motor_speed = throttle @@ -920,10 +920,10 @@ def run(self, throttle:float) -> None: where 1 is full forward and -1 is full backwards. """ if throttle is None: - logger.warn("TwoWheelSteeringThrottle throttle is None") + logger.warning("TwoWheelSteeringThrottle throttle is None") return if throttle > 1 or throttle < -1: - logger.warn( f"TwoWheelSteeringThrottle throttle is {throttle}, but it must be between 1(forward) and -1(reverse)") + logger.warning( f"TwoWheelSteeringThrottle throttle is {throttle}, but it must be between 1(forward) and -1(reverse)") throttle = clamp(throttle, -1, 1) self.speed = throttle diff --git a/donkeycar/parts/controller.py b/donkeycar/parts/controller.py index 3c556525a..ab8ef1680 100644 --- a/donkeycar/parts/controller.py +++ b/donkeycar/parts/controller.py @@ -42,11 +42,11 @@ def init(self): except ModuleNotFoundError: self.num_axes = 0 self.num_buttons = 0 - logger.warn("no support for fnctl module. joystick not enabled.") + logger.warning("no support for fnctl module. joystick not enabled.") return False if not os.path.exists(self.dev_fn): - logger.warn(f"{self.dev_fn} is missing") + logger.warning(f"{self.dev_fn} is missing") return False ''' @@ -965,7 +965,7 @@ def emergency_stop(self): ''' initiate a series of steps to try to stop the vehicle as quickly as possible ''' - logger.warn('E-Stop!!!') + logger.warning('E-Stop!!!') self.mode = "user" self.recording = False self.constant_throttle = False diff --git a/donkeycar/parts/fastai.py b/donkeycar/parts/fastai.py index f7b9a8523..bd8953543 100644 --- a/donkeycar/parts/fastai.py +++ b/donkeycar/parts/fastai.py @@ -158,11 +158,10 @@ def train(self, model = self.interpreter.model dataLoader = DataLoaders.from_dsets(train_data, validation_data, bs=batch_size, shuffle=False) - if torch.cuda.is_available(): - dataLoader.cuda() + # old way of enabling gpu now crashes with torch 2.1.* + # if torch.cuda.is_available(): + # dataLoader.cuda() - #dataLoaderTest = self.dataBlock.dataloaders.test_dl(validation_data, with_labels=True) - #print(dataLoader.train[0]) callbacks = [ EarlyStoppingCallback(monitor='valid_loss', diff --git a/donkeycar/parts/interpreter.py b/donkeycar/parts/interpreter.py index b4cf1bd5a..8af44e748 100755 --- a/donkeycar/parts/interpreter.py +++ b/donkeycar/parts/interpreter.py @@ -347,12 +347,12 @@ def load(self, model_path: str) -> None: def predict_from_dict(self, input_dict): for k, v in input_dict.items(): input_dict[k] = self.expand_and_convert(v) - out_dict = self.graph_func(**input_dict) + out_list = self.graph_func(**input_dict) # Squeeze here because we send a batch of size one, so pick first # element. To return the order of outputs as defined in the model we # need to iterate through the model's output shapes here - outputs = [out_dict[k].numpy().squeeze(axis=0) for k in - self.output_keys] + outputs = [k.numpy().squeeze(axis=0) for k in out_list] + # don't return list if output is 1d return outputs if len(outputs) > 1 else outputs[0] diff --git a/donkeycar/parts/kinematics.py b/donkeycar/parts/kinematics.py index 360c740de..7fb9e9ab6 100644 --- a/donkeycar/parts/kinematics.py +++ b/donkeycar/parts/kinematics.py @@ -582,7 +582,7 @@ def run(self, steering) -> float: return 0 if steering > 1 or steering < -1: - logger.warn(f"steering = {steering}, but must be between 1(right) and -1(left)") + logger.warning(f"steering = {steering}, but must be between 1(right) and -1(left)") steering = clamp(steering, -1, 1) @@ -632,14 +632,14 @@ def differential_steering(throttle: float, steering: float, steering_zero: float logger.error("throttle must be a number") return 0, 0 if throttle > 1 or throttle < -1: - logger.warn(f"throttle = {throttle}, but must be between 1(right) and -1(left)") + logger.warning(f"throttle = {throttle}, but must be between 1(right) and -1(left)") throttle = clamp(throttle, -1, 1) if not is_number_type(steering): logger.error("steering must be a number") return 0, 0 if steering > 1 or steering < -1: - logger.warn(f"steering = {steering}, but must be between 1(right) and -1(left)") + logger.warning(f"steering = {steering}, but must be between 1(right) and -1(left)") steering = clamp(steering, -1, 1) left_throttle = throttle diff --git a/donkeycar/parts/pins.py b/donkeycar/parts/pins.py index f9c4091c5..3607ab1c4 100644 --- a/donkeycar/parts/pins.py +++ b/donkeycar/parts/pins.py @@ -400,7 +400,7 @@ def pwm_pin( gpio_pin_pull = [None, GPIO.PUD_OFF, GPIO.PUD_DOWN, GPIO.PUD_UP] gpio_pin_scheme = {PinScheme.BOARD: GPIO.BOARD, PinScheme.BCM: GPIO.BCM} except ImportError: - logger.warn("RPi.GPIO was not imported.") + logger.warning("RPi.GPIO was not imported.") globals()["GPIO"] = None @@ -753,7 +753,7 @@ def duty_cycle(self, duty: float) -> None: pigpio_pin_edge = [None, pigpio.RISING_EDGE, pigpio.FALLING_EDGE, pigpio.EITHER_EDGE] pigpio_pin_pull = [None, pigpio.PUD_OFF, pigpio.PUD_DOWN, pigpio.PUD_UP] except ImportError: - logger.warn("pigpio was not imported.") + logger.warning("pigpio was not imported.") globals()["pigpio"] = None diff --git a/donkeycar/parts/serial_port.py b/donkeycar/parts/serial_port.py index cb9b84bf6..248d78ef4 100644 --- a/donkeycar/parts/serial_port.py +++ b/donkeycar/parts/serial_port.py @@ -92,7 +92,7 @@ def readBytes(self, count:int=0) -> Tuple[bool, bytes]: input = self.ser.read(count) return (waiting, input) except (serial.serialutil.SerialException, TypeError): - logger.warn("failed reading bytes from serial port") + logger.warning("failed reading bytes from serial port") return (False, b'') def read(self, count:int=0) -> Tuple[bool, str]: @@ -135,11 +135,11 @@ def readln(self) -> Tuple[bool, str]: input = buffer.decode(self.charset) return (waiting, input) except (serial.serialutil.SerialException, TypeError): - logger.warn("failed reading line from serial port") + logger.warning("failed reading line from serial port") return (False, "") except UnicodeDecodeError: # the first read often includes mis-framed garbase - logger.warn("failed decoding unicode line from serial port") + logger.warning("failed decoding unicode line from serial port") return (False, "") def writeBytes(self, value:bytes): @@ -150,7 +150,7 @@ def writeBytes(self, value:bytes): try: self.ser.write(value) except (serial.serialutil.SerialException, TypeError): - logger.warn("Can't write to serial port") + logger.warning("Can't write to serial port") def write(self, value:str): """ diff --git a/donkeycar/parts/tachometer.py b/donkeycar/parts/tachometer.py index 26d7b02fa..39cc40b9f 100644 --- a/donkeycar/parts/tachometer.py +++ b/donkeycar/parts/tachometer.py @@ -310,7 +310,7 @@ def __init__(self, gpio_pin: InputPin, debounce_ns:int=0, debug=False): self.debounce_ns:int = debounce_ns self.debounce_time:int = 0 if self.debounce_ns > 0: - logger.warn("GpioEncoder debounce_ns will be ignored.") + logger.warning("GpioEncoder debounce_ns will be ignored.") self.lock = threading.Lock() def _cb(self): diff --git a/donkeycar/tests/test_keras.py b/donkeycar/tests/test_keras.py index 366bba788..b807a190e 100644 --- a/donkeycar/tests/test_keras.py +++ b/donkeycar/tests/test_keras.py @@ -78,7 +78,7 @@ def test_keras_vs_tflite_and_tensorrt(keras_pilot, tmp_dir): # lstm cells are not yet supported in tensor RT out3 = k_trt.run(*args) assert out3 == approx(out1, rel=TOLERANCE, abs=TOLERANCE) - print("\n", out1, out2, out3) + print('keras:', out1, 'tflite:', out2, 'trt:', out3) diff --git a/setup.cfg b/setup.cfg index 22aaea135..76ca5e58b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -86,7 +86,7 @@ dev = mypy torch = - torch + torch==2.1.* pytorch-lightning torchvision torchaudio