本研究旨在探索和實現基於GPT-2和近端策略優化(PPO)強化學習的 符號音樂生成方法。音樂生成在人工智慧與機器學習領域中一直是重要 的研究課題之一,目的是通過算法自動生成具有藝術價值和情感表達的 音樂作品。本研究通過探討GPT-2在生成旋律、伴奏及和弦方面的應用潛 力,並引入PPO強化學習算法,提升生成音樂的質量和多樣性。研究結果 表明,結合GPT-2和PPO的符號音樂生成方法能夠有效提升音樂的創造性 和多樣性,為音樂創作和應用帶來新的可能性。本研究不僅在理論上具有 重要意義,還在實際應用中具有廣泛的前景。;This study aims to explore and implement a symbolic music generation method based on GPT-2 and Proximal Policy Optimization (PPO) reinforcement learning. Music gen eration has long been an important research topic in the fields of artificial intelligence and machine learning, aiming to automatically generate music works with artistic value and emotional expression through algorithms. This research explores the application potential of GPT-2 in generating melodies, accompaniments, and chords, and introduces the PPO reinforcement learning algorithm to improve the quality and diversity of gen erated music. The results show that the symbolic music generation method combining GPT-2 and PPO can effectively enhance the creativity and diversity of music, bringing new possibilities to music creation and application. This research is of great theoretical significance and has broad prospects for practical application.