The Internet of Vehicles (IoV) has greatly influenced transportation by allowing autonomous vehicles to interact and communicate with other cars as well as with the surrounding traffic system. Even so, being interconnected comes with risks in terms of cyber attacks, for example, by injecting messages or fooling sensors through CAN systems. The study, consequently, suggests an Intrusion Detection System (IDS) that uses Convolutional Neural Networks (CNN), Recurrent Neural Networks (RNN), Long Short-Term Memory (LSTM), Bidirectional Encoder Representations from Transformers (BERT), and RoBERTa, to properly detect and handle these cyber threats. To solve the problem of unbalanced data, we use Random Over-Sampling (ROS), NearMiss, and Tomek Links, which makes the model work more effectively. Results from experiments show that the IDS suggested here is better than traditional machine learning models. Adopting cloud computing helps make the system more flexible and lets it be watched continually to keep AVs well protected. An IDS in smart cities greatly benefits vehicle networks, as it hinders and stops possible cyberattacks. Related work will aim to improve IDS performance for big organizations and cope with new types of attacks.