o
    ॵiBQ                     @   st  d dl Z G dd deZG dd deZG dd deZG dd	 d	eZG d
d deZG dd deZG dd deZG dd deeeeeZ	G dd deZ
G dd de jZG dd de jZG dd de jZG dd de jZG dd de jZejdgejdgejdgiZG d d! d!eZG d"d# d#eZG d$d% d%eZG d&d' d'eZG d(d) d)eZG d*d+ d+eZG d,d- d-eZd.Zd/ZeegZdZd0Z d0Z!d0Z"d1Z#d2Z$G d3d4 d4Z%G d5d6 d6Z&G d7d8 d8Z'G d9d: d:Z(G d;d< d<Z)d=d=d>d>d?d@dAZ*dBZ+G dCdD dDZ,G dEdF dFZ-dGdHdIdJZ.G dKdL dLeZ/G dMdN dNZ0G dOdP dPZ1dQZ2G dRdS dSZ3dS )T    Nc                   @   4   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdS )Fieldsz, Names for different application fields
    hubdatasets	frameworkcvnlpaudiozmulti-modalscienceserverN)__name__
__module____qualname____doc__r   r   r   r   r   r	   multi_modalr
   r    r   r   M/home/ubuntu/.local/lib/python3.10/site-packages/modelscope/utils/constant.pyr          r   c                   @   s  e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7Z9d8Z:d9Z;d:Z<d;Z=d<Z>d=Z?d>Z@d?ZAd@ZBdAZCdBZDdCZEdDZFdEZGdFZHdGZIdHZJdIZKdJZLdKZMdLZNdMZOdNZPdOZQdPZRdQZSdRZTdSZUdTZVdUZWdVZXdWZYdXZZdYZ[dZZ\d[Z]d\Z^d]Z_d^Z`d_Zad`ZbdaZcdbZddcZeddZfdeZgdfZhdgZidhZjdiZkdjZldkZmdlZndmZodnZpdoZqdpZrdqZsdrZtdsZudtZvduZwdvZxdwZydxZzdyZ{dzZ|d{Z}d|Z~d}Zd~ZdZdZdZdS )CVTaskszocr-detectionzocr-recognitionztable-recognitionzlineless-table-recognitionzlicense-plate-detectionzcard-detection-correctionzanimal-recognitionzface-detectionzface-livenesszface-quality-assessmentzcard-detectionzface-recognitionzfacial-expression-recognitionzface-processing-basezface-attribute-recognitionzface-2d-keypointszhuman-detectionzhuman-object-interactionzface-image-generationzbody-2d-keypointszbody-3d-keypointszhand-2d-keypointszgeneral-recognitionzhuman-wholebody-keypointz pedestrian-attribute-recognitionzimage-classificationzimage-multilabel-classificationzimage-classification-imagenetzimage-classification-dailylifezimage-object-detectionzvideo-object-detectionzimage-fewshot-detectionzopen-vocabulary-detectionzobject-detection-3dzimage-segmentationzsemantic-segmentationzimage-driving-perceptionzimage-depth-estimationzdense-optical-flow-estimationzimage-normal-estimationzindoor-layout-estimationzvideo-depth-estimationzpanorama-depth-estimationzportrait-mattingzuniversal-mattingztext-driven-segmentationzshop-segmentationzhand-staticzface-human-hand-detectionzface-emotionzproduct-segmentationzimage-matchingzimage-local-feature-matchingz$image-quality-assessment-degradationzhuman-normal-estimationzcrowd-countingzskin-retouchingzimage-super-resolutionzimage-super-resolution-pasdzimage-debandingzimage-colorizationzimage-color-enhancementzimage-denoisingzimage-deblurringzimage-portrait-enhancementzimage-inpaintingzimage-paintbyexamplezimage-skychangezimage-demoireingzimage-editingzimage-to-image-translationzimage-to-image-generationzimage-style-transferzimage-portrait-stylizationzimage-body-reshapingzimage-embeddingzimage-face-fusionzproduct-retrieval-embeddingzcontrollable-image-generationztext-to-360panorama-imagezimage-try-onzhuman-image-generationzimage-view-transformzlive-categoryzaction-recognitionzaction-detectionzvideo-categoryzvideo-embeddingzvirtual-try-onzmovie-scene-segmentationz#language-guided-video-summarizationzvideo-text-retrievalzvideo-object-segmentationz#referring-video-object-segmentationzvideo-human-mattingzvideo-panoptic-segmentationzvideo-instance-segmentationzvideo-inpaintingzvideo-frame-interpolationzvideo-stabilizationzvideo-super-resolutionzvideo-deinterlacezvideo-colorizationzvideo-single-object-trackingzvideo-multi-object-trackingzvideo-summarizationzimage-reid-personzpointcloud-sceneflow-estimationz!image-multi-view-depth-estimationz domain-specific-object-detectionzcontent-checkzface-reconstructionzhead-reconstructionztext-to-headzhuman-reconstructionztext-texture-generationzimage-quality-assessment-moszmotion-generationznerf-recon-accznerf-recon-4kznerf-recon-vq-compressionzsurface-recon-commonzhuman3d-renderzhuman3d-animationzimage-control-3d-portraitz self-supervised-depth-completionzimage-to-3dzvision-efficient-tuningzbad-image-detectingN)r   r   r   ocr_detectionocr_recognitiontable_recognitionlineless_table_recognitionlicense_plate_detectioncard_detection_correctionanimal_recognitionface_detectionface_livenessface_quality_assessmentcard_detectionface_recognitionfacial_expression_recognitionface_processing_baseface_attribute_recognitionface_2d_keypointshuman_detectionhuman_object_interactionface_image_generationbody_2d_keypointsbody_3d_keypointshand_2d_keypointsgeneral_recognitionhuman_wholebody_keypoint pedestrian_attribute_recognitionimage_classificationimage_multilabel_classificationimage_classification_imagenetimage_classification_dailylifeimage_object_detectionvideo_object_detectionimage_fewshot_detectionopen_vocabulary_detectionobject_detection_3dimage_segmentationsemantic_segmentationimage_driving_perceptionimage_depth_estimationdense_optical_flow_estimationimage_normal_estimationindoor_layout_estimationvideo_depth_estimationpanorama_depth_estimationportrait_mattinguniversal_mattingtext_driven_segmentationshop_segmentationhand_staticface_human_hand_detectionface_emotionproduct_segmentationimage_matchingimage_local_feature_matching$image_quality_assessment_degradationhuman_normal_estimationcrowd_countingskin_retouchingimage_super_resolutionimage_super_resolution_pasdimage_debandingimage_colorizationimage_color_enhancementimage_denoisingimage_deblurringimage_portrait_enhancementimage_inpaintingimage_paintbyexampleimage_skychangeimage_demoireingimage_editingimage_to_image_translationimage_to_image_generationimage_style_transferimage_portrait_stylizationimage_body_reshapingimage_embeddingimage_face_fusionproduct_retrieval_embeddingcontrollable_image_generationtext_to_360panorama_imageimage_try_onhuman_image_generationimage_view_transformlive_categoryaction_recognitionaction_detectionvideo_categoryvideo_embeddingvirtual_try_onmovie_scene_segmentation#language_guided_video_summarizationvop_retrievalvideo_object_segmentation#referring_video_object_segmentationvideo_human_mattingvideo_panoptic_segmentationvideo_instance_segmentationvideo_inpaintingvideo_frame_interpolationvideo_stabilizationvideo_super_resolutionvideo_deinterlacevideo_colorizationvideo_single_object_trackingvideo_multi_object_trackingvideo_summarizationimage_reid_personpointcloud_sceneflow_estimation!image_multi_view_depth_estimation domain_specific_object_detectioncontent_checkface_reconstructionhead_reconstructiontext_to_headhuman_reconstructiontext_texture_generationimage_quality_assessment_mosmotion_generationnerf_recon_accnerf_recon_4knerf_recon_vq_compressionsurface_recon_commonhuman3d_renderhuman3d_animationimage_control_3d_portrait self_supervised_depth_completionimage_to_3dvision_efficient_tuningbad_image_detectingr   r   r   r   r      s   r   c                   @   s   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0S )1NLPTaskschatzword-segmentationzpart-of-speechznamed-entity-recognitionnlizsentiment-classificationzsentiment-analysiszsentence-similarityztext-classificationzsentence-embeddingztext-rankingzrelation-extractionz	zero-shottranslationzcompetency-aware-translationztoken-classificationztransformer-crfconversationalztext-generationzfid-dialogueztext2text-generationztask-oriented-conversationzdialog-intent-predictionzdialog-state-trackingztable-question-answeringz	fill-maskztext-summarizationzquestion-answeringzcode-translationzcode-generationzzero-shot-classificationbackboneztext-error-correctionzword-alignmentzfaq-question-answeringzinformation-extractionzdocument-segmentationzextractive-summarizationzfeature-extractionztranslation-evaluationsudokutext2sqlzsiamese-uiez"document-grounded-dialog-retrievalzdocument-grounded-dialog-rerankz!document-grounded-dialog-generatezmachine-reading-comprehensionN)2r   r   r   r   word_segmentationpart_of_speechnamed_entity_recognitionr   sentiment_classificationsentiment_analysissentence_similaritytext_classificationsentence_embeddingtext_rankingrelation_extraction	zero_shotr   competency_aware_translationtoken_classificationtransformer_crfr   text_generationfid_dialoguetext2text_generationtask_oriented_conversationdialog_intent_predictiondialog_state_trackingtable_question_answering	fill_masktext_summarizationquestion_answeringcode_translationcode_generationzero_shot_classificationr   text_error_correctionword_alignmentfaq_question_answeringinformation_extractiondocument_segmentationextractive_summarizationfeature_extractiontranslation_evaluationr   r   siamese_uie"document_grounded_dialog_retrievaldocument_grounded_dialog_rerank!document_grounded_dialog_generatemachine_reading_comprehensionr   r   r   r   r      s`    r   c                   @   sX   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdS )
AudioTaskszauto-speech-recognitionztext-to-speechzspeech-signal-processzspeech-separationzacoustic-echo-cancellationzacoustic-noise-suppressionzkeyword-spottingzinverse-text-processingpunctuationzspeaker-verificationzspeech-language-recognitionzspeaker-diarizationzaudio-quantizationzvoice-activity-detectionzlanguage-score-predictionzspeech-timestampz&speaker-diarization-dialogue-detectionz3speaker-diarization-semantic-speaker-turn-detectionzemotion-recognitionN)r   r   r   auto_speech_recognitiontext_to_speechspeech_signal_processspeech_separationacoustic_echo_cancellationacoustic_noise_suppressionkeyword_spottinginverse_text_processingr   speaker_verificationspeech_language_recognitionspeaker_diarizationaudio_quantizationvoice_activity_detectionlanguage_score_predictionspeech_timestamp&speaker_diarization_dialogue_detection3speaker_diarization_semantic_speaker_turn_detectionemotion_recognitionr   r   r   r   r      s(    r   c                   @   s\   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdS )MultiModalTaskszimage-captioningzvisual-groundingztext-to-image-synthesiszmulti-modal-embeddingztext-video-retrievalz generative-multi-modal-embeddingzmulti-modal-similarityzvisual-question-answeringzvisual-entailmentzvideo-multi-modal-embeddingzimage-text-retrievalzdocument-vl-embeddingzvideo-captioningzvideo-question-answeringzvideo-temporal-groundingztext-to-video-synthesiszefficient-diffusion-tuningzmultimodal-dialoguezimage-to-videozvideo-to-videoN)r   r   r   image_captioningvisual_groundingtext_to_image_synthesismulti_modal_embeddingtext_video_retrieval generative_multi_modal_embeddingmulti_modal_similarityvisual_question_answeringvisual_entailmentvideo_multi_modal_embeddingimage_text_retrievaldocument_vl_embeddingvideo_captioningvideo_question_answeringvideo_temporal_groundingtext_to_video_synthesisefficient_diffusion_tuningmultimodal_dialogueimage_to_videovideo_to_videor   r   r   r   r     s*    r   c                   @      e Zd ZdZdS )ScienceTaskszprotein-structureN)r   r   r   protein_structurer   r   r   r   r   #      r   c                   @   sD   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdS )TasksIODescriptions)image_to_image)images_to_image)image_to_text)seed_to_image)r   )text_to_text)speech_to_textspeech_to_speech)speeches_to_speech)r   )r   )r   r   r   N)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   '  s    r   c                   @   s$   e Zd ZdZi ZdZedd ZdS )Tasksz Names for tasks supported by modelscope.

    Holds the standard task name to use for identifying different tasks.
    This should be used to register models, pipelines, trainers.
    ztask-templatec                 C   s   t tjdkrZtjdd ttD tjdd ttD tj	dd tt
D tjdd ttD tjdd ttD i}| D ]\}}|D ]}|tjv rStd| |tj|< qEq?tj| S )	Nr   c                 S       g | ]}| d stt|qS __
startswithgetattrr   .0attrr   r   r   
<listcomp>F      z,Tasks.find_field_by_task.<locals>.<listcomp>c                 S   r   r   r   r  r   r   r   r  J  r  c                 S   r   r   r   r  r   r   r   r  N  r  c                 S   r   r   r   r  r   r   r   r  R  r  c                 S   r   r   r   r  r   r   r   r  V  r  zDuplicate task: )lenr   reverse_field_indexr   r   dirr   r   r   r	   r   r   r   r
   r   items
ValueErrorget)	task_name
field_dictfieldtaskstaskr   r   r   find_field_by_taskA  s0   





zTasks.find_field_by_taskN)r   r   r   r   r	  task_templatestaticmethodr  r   r   r   r   r   8  s    r   c                   @      e Zd ZdZdZdZdZdS )InputFieldszA Names for input data fields in the input data for pipelines
    imgtextr	   N)r   r   r   r   r  r  r	   r   r   r   r   r  e  
    r  c                   @   r  )HubszH Source from which an entity (such as a Dataset or Model) is stored
    
modelscopehuggingfacevirgoN)r   r   r   r   r  r  r  r   r   r   r   r  m  r  r  c                   @      e Zd ZdZdZdZdS )DownloadModez$ How to treat existing datasets
    reuse_dataset_if_existsforce_redownloadN)r   r   r   r   REUSE_DATASET_IF_EXISTSFORCE_REDOWNLOADr   r   r   r   r   u  s    r   c                   @   r  )DownloadChannelz: Channels of datasets downloading for uv/pv counting.
    localdsweaisN)r   r   r   r   LOCALDSWEAISr   r   r   r   r%  |  r  r%  c                   @   r  )
UploadModez% How to upload object to remote.
    	overwriteappendN)r   r   r   r   	OVERWRITEAPPENDr   r   r   r   r,    s    r,  c                   @       e Zd ZdZdZdZdZdZdS )DatasetFormationsz0 How a dataset is organized and interpreted
             z.formation_markN)r   r   r   r   hf_compatiblenativegeneralformation_mark_extr   r   r   r   r2    s    r2  z.jsonz.pyc                   @   sP   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdS )	ModelFilezconfiguration.jsonz	README.mdzsaved_model.pbztf_graph.pbtf_ckptszckpt-zpytorch_model.ptzpytorch_model.binz	vocab.txtz
model.onnxzlabel_mapping.jsonoutputoutput_bestzmodel.tsz
model.yaml	tokenizerzconfig.jsonN)r   r   r   CONFIGURATIONREADMETF_SAVED_MODEL_FILETF_GRAPH_FILETF_CHECKPOINT_FOLDERTF_CKPT_PREFIXTORCH_MODEL_FILETORCH_MODEL_BIN_FILE
VOCAB_FILEONNX_MODEL_FILELABEL_MAPPINGTRAIN_OUTPUT_DIRTRAIN_BEST_OUTPUT_DIRTS_MODEL_FILE	YAML_FILETOKENIZER_FOLDERCONFIGr   r   r   r   r:    s$    r:  c                   @   s$   e Zd ZdZdZdZdZdZdZdS )Invoke
invoked_byfrom_pretrainedpipelinetrainerlocal_trainerpreprocessorN)	r   r   r   KEY
PRETRAINEDPIPELINETRAINERLOCAL_TRAINERPREPROCESSORr   r   r   r   rP    s    rP  c                   @   r  )
ThirdPartythird_partyeasycvadaseqadadetN)r   r   r   rW  EASYCVADASEQADADETr   r   r   r   r]    
    r]  c                   @   r   )ConfigFieldsz/ First level keyword in configuration file
    r   r  rS  modeldatasetrV  train
evaluationpostprocessorN)r   r   r   r   r   r  rS  rg  rh  rV  ri  rj  rk  r   r   r   r   rf    r   rf  c                   @   r  )
ConfigKeysz$Fixed keywords in configuration fileri  valtestN)r   r   r   r   ri  rm  rn  r   r   r   r   rl    re  rl  c                   @   0   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
S )Requirementsz&Requirement names for each module
    protobufsentencepiecesklearnscipytimm
tokenizerstftorchN)r   r   r   r   rq  rr  rs  rt  ru  rv  rw  rx  r   r   r   r   rp    s    rp  c                   @   r  )
Frameworks
tensorflowpytorchkaldiN)r   r   r   rw  rx  r|  r   r   r   r   ry        ry  rg  rh  masterr  z#https://oss-accelerate.aliyuncs.comc                   @   r  )ModeKeysri  eval	inferenceN)r   r   r   TRAINEVAL	INFERENCEr   r   r   r   r    r}  r  c                   @   ro  )LogKeysiter	iter_timeepochlrmodedata_load_timeetamemorylossN)r   r   r   ITER	ITER_TIMEEPOCHLRMODEDATA_LOAD_TIMEETAMEMORYLOSSr   r   r   r   r    s    r  c                   @   s@   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdS )TrainerStages
after_init
before_run
before_valbefore_train_epochbefore_train_iterafter_train_iterafter_train_epochbefore_val_epochbefore_val_iterafter_val_iterafter_val_epoch	after_run	after_valN)r   r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r   r    s    r  c                   @   r1  )
ColorCodesz[95mz[93mz[92mz[91mz[0mN)r   r   r   MAGENTAYELLOWGREENREDENDr   r   r   r   r    s    r  c                   @   r  )Devicesz&device used for training and inferencecpugpuN)r   r   r   r   r  r  r   r   r   r   r  '  r}  r  csvjsonparquetr  )r  tsvr  jsonlr  txt)z.csvz.jsonlc                   @   r  )DatasetPathNamemeta
data_filesany-N)r   r   r   	META_NAMEDATA_FILES_NAMELOCK_FILE_NAME_ANYLOCK_FILE_NAME_DELIMITERr   r   r   r   r  :  re  r  c                   @   r   )MetaDataFieldsbig_dataN)r   r   r   ARGS_BIG_DATAr   r   r   r   r  A  r   r  privateinternalpublic)r3        c                   @   r  )DistributedParallelTypez*Parallel Strategies for Distributed Modelsdata_paralleltensor_model_parallelpipeline_model_parallelN)r   r   r   r   DPTPPPr   r   r   r   r  H  re  r  c                   @   s   e Zd ZdZdZdS )DatasetTensorflowConfig
batch_sizer  N)r   r   r   
BATCH_SIZEDEFAULT_BATCH_SIZE_VALUEr   r   r   r   r  O  s    r  c                   @   r   )VirgoDatasetConfigdefault_namespace1VIRGO_ENDPOINTmetaContentsamplingTypeid	meta_infoanalysis_resultexternal_info
cache_fileN)r   r   r   default_virgo_namespacedefault_dataset_versionenv_virgo_endpointmeta_contentsampling_typecol_idcol_meta_infocol_analysis_resultcol_external_infocol_cache_filer   r   r   r   r  T  s    r  z+http://service-corp.odps.aliyun-inc.com/apic                   @   r  )MaxComputeEnvsODPS_ACCESS_IDODPS_ACCESS_SECRET_KEYODPS_PROJECT_NAMEODPS_ENDPOINTN)r   r   r   	ACCESS_IDACCESS_SECRET_KEYPROJECT_NAMEENDPOINTr   r   r   r   r  k  s
    r  )4enumobjectr   r   r   r   r   r   r   r   r  Enumr  r   r%  r,  r2  r7  r6  r8  DatasetMetaFormatsr:  rP  r]  rf  rl  rp  ry  REPO_TYPE_MODELREPO_TYPE_DATASETREPO_TYPE_SUPPORTDEFAULT_MODEL_REVISIONMASTER_MODEL_BRANCHDEFAULT_REPOSITORY_REVISIONDEFAULT_DATASET_REVISIONDEFAULT_DATASET_NAMESPACE"DEFAULT_DATA_ACCELERATION_ENDPOINTr  r  r  r  r  EXTENSIONS_TO_LOADMETA_FILES_FORMATr  r  DatasetVisibilityMapr  r  r  DEFAULT_MAXCOMPUTE_ENDPOINTr  r   r   r   r   <module>   sr    .4-			