Код: Выделить всё
import warnings
warnings.filterwarnings("ignore")
from torch import multiprocessing
from collections import defaultdict
import matplotlib.pyplot as plt
import torch
from tensordict.nn import TensorDictModule
from tensordict.nn.distributions import NormalParamExtractor
from torch import nn
from torchrl.collectors import SyncDataCollector
from torchrl.data.replay_buffers import ReplayBuffer
from torchrl.data.replay_buffers.samplers import SamplerWithoutReplacement
from torchrl.data.replay_buffers.storages import LazyTensorStorage
from torchrl.envs import (Compose, DoubleToFloat, ObservationNorm, StepCounter,
TransformedEnv)
from torchrl.envs.libs.gym import GymEnv
from torchrl.envs.utils import check_env_specs, ExplorationType, set_exploration_type
from torchrl.modules import ProbabilisticActor, TanhNormal, ValueOperator
from torchrl.objectives import ClipPPOLoss
from torchrl.objectives.value import GAE
from tqdm import tqdm
base_env = GymEnv("InvertedDoublePendulum-v2", device=device)
Код: Выделить всё
Exception has occurred: CompileError
c:\Users\forha\AppData\Local\Programs\Python\Python311\Lib\site-packages\mujoco_py\cymj.pyx
File "C:\Users\forha\OneDrive\Documents\GitHub\F1car-wAI\PTtest.py", line 51, in
base_env = GymEnv("InvertedDoublePendulum-v2", device=device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Cython.Compiler.Errors.CompileError: c:\Users\forha\AppData\Local\Programs\Python\Python311\Lib\site-packages\mujoco_py\cymj.pyx
Код: Выделить всё
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy
Подробнее здесь: [url]https://stackoverflow.com/questions/78663744/cython-compiler-error-when-running-gymenv-library-in-python[/url]