ImportError: cannot import name 'MarianMTModel' - python

import numpy as np
import torch
import torchvision
from transformers import MarianTokenizer, MarianMTModel
from typing import List
I'm getting
ImportError: cannot import name 'MarianMTModel'
I've already installed transformers. What can I do to solve this issue?
Edit : Does this import Marian model implemented in C++?

Related

ImportError: cannot import name 'combined_rule_sentence_segmenter'

I'm facing error while importing "import en_ner_bc5cdr_md"
import scispacy
import spacy
from spacy import displacy
from collections import Counter
import en_core_web_sm
import en_ner_bc5cdr_md
import en_core_sci_sm
import en_core_sci_md
import en_ner_bionlp13cg_md
from scispacy.abbreviation import AbbreviationDetector
from scispacy.umls_linking import UmlsEntityLinker
from collections import OrderedDict
from pprint import pprint
Please help
You need to download the model first, try
!pip install https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.5.1/en_ner_bc5cdr_md-0.5.1.tar.gz

Openai Gym Setup Problem Module Not Found

I'm trying to use Open AI's anytrading environment, but I'm running into this issue during setup. Has anyone come across this before?
ModuleNotFoundError: No module named 'gym.wrappers.order_enforcing'
import gym
import gym_anytrading
from stable_baselines3.common.vec_env import VecFrameStack, DummyVecEnv
from stable_baselines3 import A2C
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
env = gym.make('stocks-v0')

tensorflow keras import issues when loading retinanet model

%matplotlib inline
%load_ext autoreload
%autoreload 2
# external modules
from tensorflow import keras
from keras_retinanet import models
from keras_retinanet.utils.image import read_image_bgr, preprocess_image, resize_image
from keras_retinanet.utils.visualization import draw_box, draw_caption
from keras_retinanet.utils.colors import label_color
from keras_retinanet.utils.gpu import setup_gpu
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import cv2
import os
import numpy as np
import time
import csv
import math
import utm
import shapefile
import scipy
from scipy.spatial import distance
from urllib.request import urlopen
# internal modules
from utils import *
# set file path
root = os.getcwd()
rcnn_model_root = os.path.join(root, "trained_models")
input_gsv_root = os.path.join(root, "input_gsv")
output_gsv_root = os.path.join(root, "output_gsv")
output_shp_root = os.path.join(root, "output_shp")
rcnn_model_name = "resnet101_csv_25_inference.h5"
rcnn_model_path = os.path.join(rcnn_model_root,rcnn_model_name)
model = models.load_model(rcnn_model_path)
Every time I try to run this code I get issues with keras/tensorflow imports.
AttributeError: module 'keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects'
I was told to do from keras import tensorflow or something like that, but then I get other issues like not recognizing Freeze. This was run by someone else with a specific configuration, so downgrading packages has not worked.
keras_retinanet repository is deprecated to access from newer versions of Tensorflow.
However you can access this repository in tensorflow 2.3.0 and keras 2.4 by using below code.
!pip install tensorflow==2.3.0
!pip install keras==2.4
!pip install keras_retinanet
Please find this link to get more details on keras_retinanet repository.

ModuleNotFoundError: No module named 'Session'

When I run my python script file.py, I get an error ModuleNotFoundError: No module named 'Session'.
The imports on my script:
import os
import sys
import tensorflow as tf
import numpy as np
import random
import time
import requests
from requests import Request, Session
from flask_session import Session
from flask_session.__init__ import Session
import Session
from setup_inception import ImageNet, InceptionModel
You should not use from flask_session import Session
Instead use from flask_session.__init__ import Session
I'm sorry for the late answer, I have solved the problem with command:
import tensorflow.compat.v1 as tf
instead of
import tensorflow as tf
because I 'm using tensorflow 2.4

No module named 'ray.rllib.agents.ppo.ppo_policy'

I have this code:
from copy import deepcopy
import json
import ray
try:
from ray.rllib.agents.agent import get_agent_class
except ImportError:
from ray.rllib.agents.registry import get_agent_class
from ray.rllib.agents.ppo.ppo_policy import PPOTFPolicy
from ray import tune
from ray.tune.registry import register_env
from ray.tune import run_experiments
I am getting the error:
No module named 'ray.rllib.agents.ppo.ppo_policy'
I tried:
pip install ray;
I re installed the system and reconfigured the environment to solve this problem

Categories