无法导入 modelscope,已经pip install了
y遇到了同样的问题解决办法
pip install transformers
观察源代码发现以下内容
from typing import TYPE_CHECKING
from modelscope.utils.import_utils import (LazyImportModule,
is_transformers_available)
from .utils.automodel_utils import fix_transformers_upgrade
if TYPE_CHECKING:
from .exporters import Exporter, TfModelExporter, TorchModelExporter
from .hub.api import HubApi
from .hub.check_model import check_local_model_is_latest, check_model_is_id
from .hub.push_to_hub import push_to_hub, push_to_hub_async
from .hub.snapshot_download import snapshot_download
from .metrics import (
AccuracyMetric, AudioNoiseMetric, BleuMetric, ImageColorEnhanceMetric,
ImageColorizationMetric, ImageDenoiseMetric, ImageInpaintingMetric,
ImageInstanceSegmentationCOCOMetric, ImagePortraitEnhancementMetric,
ImageQualityAssessmentDegradationMetric,
ImageQualityAssessmentMosMetric, LossMetric, Metric,
MovieSceneSegmentationMetric, OCRRecognitionMetric, PplMetric,
ReferringVideoObjectSegmentationMetric, SequenceClassificationMetric,
TextGenerationMetric, TextRankingMetric, TokenClassificationMetric,
VideoFrameInterpolationMetric, VideoStabilizationMetric,
VideoSummarizationMetric, VideoSuperResolutionMetric,
task_default_metrics)
from .models import Model, TorchModel
from .msdatasets import MsDataset
from .pipelines import Pipeline, pipeline
from .preprocessors import Preprocessor
from .trainers import (EpochBasedTrainer, Hook, Priority, TrainingArgs,
build_dataset_from_file)
from .utils.constant import Tasks
if is_transformers_available():
from .utils.hf_util import AutoConfig, GPTQConfig, AwqConfig, BitsAndBytesConfig
from .utils.hf_util import (AutoModel, AutoModelForCausalLM,
AutoModelForSeq2SeqLM,
AutoModelForSequenceClassification,
AutoModelForTokenClassification,
AutoTokenizer, GenerationConfig,
AutoImageProcessor, BatchFeature)
is_transformers_available这个判断是在判断transformers是否存在
赞0
踩0