Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to python 3.11 and TensorFlow 2.15.X #1170

Merged
merged 5 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create python 3.9 conda env
- name: Create python 3.11 conda env
uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.9
python-version: 3.11
mamba-version: "*"
activate-environment: donkey
auto-activate-base: false
Expand Down
6 changes: 3 additions & 3 deletions donkeycar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pyfiglet import Figlet
import logging

__version__ = '5.1.dev0'
__version__ = '5.1.dev1'

logging.basicConfig(level=os.environ.get('LOGLEVEL', 'INFO').upper())

Expand All @@ -13,8 +13,8 @@
print(f.renderText('Donkey Car'))
print(f'using donkey v{__version__} ...')

if sys.version_info.major < 3 or sys.version_info.minor < 8:
msg = f'Donkey Requires Python 3.8 or greater. You are using {sys.version}'
if sys.version_info.major < 3 or sys.version_info.minor < 11:
msg = f'Donkey Requires Python 3.11 or greater. You are using {sys.version}'
raise ValueError(msg)

# The default recursion limits in CPython are too small.
Expand Down
2 changes: 1 addition & 1 deletion donkeycar/management/ui.kv
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
valign: 'middle'
font_size: 14 if platform == 'linux' else 28
size_hint_x: 0.8
padding_x: 10
padding: 10, 0
canvas.before:
Color:
rgba: 0.14, 0.15, 0.22, 1
Expand Down
4 changes: 2 additions & 2 deletions donkeycar/parts/pytorch/torch_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def train(cfg, tub_paths, model_output_path, model_type, checkpoint_path=None):

if cfg.PRINT_MODEL_SUMMARY:
summarize(model)
trainer = pl.Trainer(gpus=gpus, logger=logger, max_epochs=cfg.MAX_EPOCHS,
default_root_dir=output_dir)
trainer = pl.Trainer(accelerator='cpu', logger=logger,
DocGarbanzo marked this conversation as resolved.
Show resolved Hide resolved
max_epochs=cfg.MAX_EPOCHS, default_root_dir=output_dir)

data_module = TorchTubDataModule(cfg, tub_paths)
trainer.fit(model, data_module)
Expand Down
3 changes: 2 additions & 1 deletion donkeycar/parts/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import numpy as np
from logging import StreamHandler
from paho.mqtt.client import Client as MQTTClient
from paho.mqtt.enums import CallbackAPIVersion

logger = logging.getLogger()

Expand All @@ -40,7 +41,7 @@ def __init__(self, cfg):
self._mqtt_broker = os.environ.get('DONKEY_MQTT_BROKER', cfg.TELEMETRY_MQTT_BROKER_HOST) # 'iot.eclipse.org'
self._topic = cfg.TELEMETRY_MQTT_TOPIC_TEMPLATE % self._donkey_name
self._use_json_format = cfg.TELEMETRY_MQTT_JSON_ENABLE
self._mqtt_client = MQTTClient()
self._mqtt_client = MQTTClient(callback_api_version=CallbackAPIVersion.VERSION2)
self._mqtt_client.connect(self._mqtt_broker, cfg.TELEMETRY_MQTT_BROKER_PORT)
self._mqtt_client.loop_start()
self._on = True
Expand Down
10 changes: 4 additions & 6 deletions donkeycar/tests/test_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import time
from unittest import mock
from paho.mqtt.client import Client
from paho.mqtt.enums import CallbackAPIVersion

import donkeycar.templates.cfg_complete as cfg
from donkeycar.parts.telemetry import MqttTelemetry
import pytest
from random import randint


Expand All @@ -16,11 +17,8 @@ def test_mqtt_telemetry():
cfg.TELEMETRY_MQTT_JSON_ENABLE = True

# Create receiver
sub = Client(clean_session=True)

# def on_message(client, userdata, message):
# data = message.payload
# print(message)
sub = Client(callback_api_version=CallbackAPIVersion.VERSION2,
clean_session=True)

on_message_mock = mock.Mock()
sub.on_message = on_message_mock
Expand Down
2 changes: 1 addition & 1 deletion donkeycar/tests/test_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def test_training_pipeline(config: Config, model_type: str, car_dir: str) \
gpus = 0

# Overfit the data
trainer = pl.Trainer(gpus=gpus, overfit_batches=2, max_epochs=30)
trainer = pl.Trainer(accelerator='cpu', overfit_batches=2, max_epochs=30)
trainer.fit(model, data_module)
final_loss = model.loss_history[-1]
assert final_loss < 0.35, \
Expand Down
29 changes: 14 additions & 15 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ classifiers =
# Indicate who your project is intended for
Intended Audience :: Developers
Topic :: Scientific/Engineering :: Artificial Intelligence
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.11

[options]
packages = find_namespace:
zip_safe = True
include_package_data = True
python_requires = >=3.8,<4
python_requires = >=3.11.0,<3.12
install_requires =
numpy
pillow
Expand All @@ -35,7 +34,6 @@ install_requires =
paho-mqtt
simple_pid
progress
typing_extensions
pyfiglet
psutil
pynmea2
Expand All @@ -51,32 +49,32 @@ pi =
adafruit-circuitpython-ssd1306
adafruit-circuitpython-rplidar
RPi.GPIO
tensorflow-aarch64==2.9.3
tensorflow-aarch64==2.15.*
opencv-contrib-python

nano =
Adafruit_PCA9685
adafruit-circuitpython-ssd1306
adafruit-circuitpython-rplidar
Jetson.GPIO
numpy==1.23
matplotlib==3.7
kivy==2.1
numpy==1.23.*
matplotlib==3.7.*
kivy
plotly
pandas==2.0
pandas==2.0.*

pc =
tensorflow==2.9
tensorflow==2.15.*
matplotlib
kivy==2.1
kivy
pandas
plotly
albumentations

macos =
tensorflow-macos==2.9
tensorflow-macos==2.15.*
matplotlib
kivy==2.1
kivy
pandas
plotly
albumentations
Expand All @@ -88,8 +86,9 @@ dev =
mypy

torch =
pytorch
torchvision==0.12
torch
pytorch-lightning
torchvision
torchaudio
fastai

Expand Down
Loading