o
    rqiR                  	   @   s  d dl Z 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Z
G dd de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d0Zd1ZeegZ dZ!d2Z"d2Z#d2Z$d3Z%d4Z&e'ej()d5d6* Z+e'ej()d7d8* Z,G d9d: d:Z-G d;d< d<Z.G d=d> d>Z/G d?d@ d@Z0G dAdB dBZ1dCdCdDdDdEdFdGZ2dHZ3G dIdJ dJZ4G dKdL dLZ5G dMdN dNeZ6G dOdP dPZ7G dQdR dRZ8dSZ9G dTdU dUZ:dS )V    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   `/home/app/PaddleOCR-VL/.venv_paddleocr/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ZdZdZdZdS )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facial-68ldk-detectionz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   Z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facial_68ldk_detectionZ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vop_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_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   Zword_segmentationZpart_of_speechZnamed_entity_recognitionr   Zsentiment_classificationZsentiment_analysisZsentence_similarityZtext_classificationZsentence_embeddingZtext_rankingZrelation_extractionZ	zero_shotr   Zcompetency_aware_translationZtoken_classificationZtransformer_crfr   Z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_classificationr   Ztext_error_correctionZword_alignmentZfaq_question_answeringZinformation_extractionZdocument_segmentationZextractive_summarizationZfeature_extractionZtranslation_evaluationr   r   Zsiamese_uieZ"document_grounded_dialog_retrievalZdocument_grounded_dialog_rerankZ!document_grounded_dialog_generateZmachine_reading_comprehensionr   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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-recognitionzspeech-super-resolutionzvoice-conversionN)r   r   r   Zauto_speech_recognitiontext_to_speechZspeech_signal_processZspeech_separationZacoustic_echo_cancellationZacoustic_noise_suppressionZkeyword_spottingZinverse_text_processingr   Z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_recognitionZspeech_super_resolutionZvoice_conversionr   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   Zimage_captioningvisual_groundingZtext_to_image_synthesisZmulti_modal_embeddingZtext_video_retrieval generative_multi_modal_embeddingZmulti_modal_similarityvisual_question_answeringvisual_entailmentZvideo_multi_modal_embeddingZimage_text_retrievalZdocument_vl_embeddingZvideo_captioningZvideo_question_answeringZvideo_temporal_groundingZtext_to_video_synthesisefficient_diffusion_tuningZmultimodal_dialogueZimage_to_videoZvideo_to_videor   r   r   r   r      s*    r    c                   @      e Zd ZdZdS )ScienceTaskszprotein-structureN)r   r   r   Zprotein_structurer   r   r   r   r'   '      r'   c                   @   r&   )OtherotherN)r   r   r   r*   r   r   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   r0   r1   r2   r3   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getattrr4   .0attrr   r   r   
<listcomp>O      z,Tasks.find_field_by_task.<locals>.<listcomp>c                 S   r5   r6   r8   r;   r   r   r   r>   S  r?   c                 S   r5   r6   r8   r;   r   r   r   r>   W  r?   c                 S   r5   r6   r8   r;   r   r   r   r>   [  r?   c                 S   r5   r6   r8   r;   r   r   r   r>   _  r?   zDuplicate task: )lenr4   reverse_field_indexr   r   dirr   r   r   r	   r   r   r    r
   r'   items
ValueErrorget)Z	task_nameZ
field_dictfieldtaskstaskr   r   r   find_field_by_taskJ  s0   





zTasks.find_field_by_taskN)r   r   r   r   rA   Ztask_templatestaticmethodrI   r   r   r   r   r4   @  s    r4   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   rM   rN   r	   r   r   r   r   rL   n  
    rL   c                   @   rK   )HubszH Source from which an entity (such as a Dataset or Model) is stored
    
modelscopehuggingfacevirgoN)r   r   r   r   rQ   rR   rS   r   r   r   r   rP   v  rO   rP   c                   @      e Zd ZdZdZdZdS )DownloadModez$ How to treat existing datasets
    Zreuse_dataset_if_existsZforce_redownloadN)r   r   r   r   ZREUSE_DATASET_IF_EXISTSZFORCE_REDOWNLOADr   r   r   r   rU   ~  s    rU   c                   @   rK   )DownloadChannelz: Channels of datasets downloading for uv/pv counting.
    localZdswZeaisN)r   r   r   r   ZLOCALZDSWZEAISr   r   r   r   rV     rO   rV   c                   @   rT   )
UploadModez% How to upload object to remote.
    	overwriteappendN)r   r   r   r   Z	OVERWRITEAPPENDr   r   r   r   rX     s    rX   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generalZformation_mark_extr   r   r   r   r]     s    r]   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.pbZtf_ckptszckpt-zpytorch_model.ptzpytorch_model.binz	vocab.txtz
model.onnxzlabel_mapping.jsonoutputZoutput_bestzmodel.tsz
model.yamlZ	tokenizerzconfig.jsonN)r   r   r   ZCONFIGURATIONZREADMEZTF_SAVED_MODEL_FILEZTF_GRAPH_FILEZTF_CHECKPOINT_FOLDERZTF_CKPT_PREFIXZTORCH_MODEL_FILEZTORCH_MODEL_BIN_FILEZ
VOCAB_FILEZONNX_MODEL_FILEZLABEL_MAPPINGZTRAIN_OUTPUT_DIRZTRAIN_BEST_OUTPUT_DIRZTS_MODEL_FILEZ	YAML_FILEZTOKENIZER_FOLDERZCONFIGr   r   r   r   rd     s$    rd   c                   @   s$   e Zd ZdZdZdZdZdZdZdS )InvokeZ
invoked_byZfrom_pretrainedpipelineZtrainerZlocal_trainerpreprocessorN)	r   r   r   KEYZ
PRETRAINEDZPIPELINEZTRAINERZLOCAL_TRAINERZPREPROCESSORr   r   r   r   rf     s    rf   c                   @   rK   )
ThirdPartyZthird_partyZeasycvZadaseqZadadetN)r   r   r   ri   ZEASYCVZADASEQZADADETr   r   r   r   rj     
    rj   c                   @   r   )ConfigFieldsz/ First level keyword in configuration file
    r   rH   rg   modeldatasetrh   train
evaluationpostprocessorN)r   r   r   r   r   rH   rg   rm   rn   rh   ro   rp   rq   r   r   r   r   rl     r   rl   c                   @   rK   )
ConfigKeysz$Fixed keywords in configuration filero   valtestN)r   r   r   r   ro   rs   rt   r   r   r   r   rr     rk   rr   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   rw   rx   ry   rz   r{   r|   r}   r~   r   r   r   r   rv     s    rv   c                   @   rT   )
FrameworksZ
tensorflowZpytorchkaldiN)r   r   r   r}   r~   r   r   r   r   r   r         r   rm   rn   ZmasterrQ   z#https://oss-accelerate.aliyuncs.comINTRA_CLOUD_ACCELERATIONTrueINTRA_CLOUD_ACCELERATION_REGION c                   @   rT   )ModeKeysro   evalZ	inferenceN)r   r   r   ZTRAINZEVALZ	INFERENCEr   r   r   r   r   
  r   r   c                   @   ru   )LogKeysiterZ	iter_timeepochlrmodeZdata_load_timeetaZmemoryZlossN)r   r   r   ZITERZ	ITER_TIMEEPOCHZLRZMODEZDATA_LOAD_TIMEETAZMEMORYZ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                   @   r\   )
ColorCodesz[95mz[93mz[92mz[91mz[0mN)r   r   r   ZMAGENTAZYELLOWZGREENZREDZENDr   r   r   r   r   ,  s    r   c                   @   rT   )Devicesz&device used for training and inferencecpugpuN)r   r   r   r   r   r   r   r   r   r   r   4  r   r   csvjsonparquetrN   )r   Ztsvr   Zjsonlr   txt)z.csvz.jsonlc                   @   rK   )DatasetPathNamemetaZ
data_filesany-N)r   r   r   Z	META_NAMEZDATA_FILES_NAMEZLOCK_FILE_NAME_ANYZLOCK_FILE_NAME_DELIMITERr   r   r   r   r   G  rk   r   c                   @   r&   )MetaDataFieldsZbig_dataN)r   r   r   ZARGS_BIG_DATAr   r   r   r   r   N  r(   r   c                   @   rK   )DistributedParallelTypez*Parallel Strategies for Distributed ModelsZdata_parallelZtensor_model_parallelZpipeline_model_parallelN)r   r   r   r   ZDPZTPZPPr   r   r   r   r   R  rk   r   c                   @   s   e Zd ZdZdZdS )DatasetTensorflowConfigZ
batch_size   N)r   r   r   Z
BATCH_SIZEZDEFAULT_BATCH_SIZE_VALUEr   r   r   r   r   Y  s    r   c                   @   r   )VirgoDatasetConfigdefault_namespace1ZVIRGO_ENDPOINTZmetaContentZsamplingTypeidZ	meta_infoZanalysis_resultZexternal_infoZ
cache_fileN)r   r   r   Zdefault_virgo_namespaceZdefault_dataset_versionZenv_virgo_endpointZmeta_contentZsampling_typeZcol_idZcol_meta_infoZcol_analysis_resultZcol_external_infoZcol_cache_filer   r   r   r   r   ^  s    r   z+http://service-corp.odps.aliyun-inc.com/apic                   @   rK   )MaxComputeEnvsZODPS_ACCESS_IDZODPS_ACCESS_SECRET_KEYZODPS_PROJECT_NAMEZODPS_ENDPOINTN)r   r   r   Z	ACCESS_IDZACCESS_SECRET_KEYZPROJECT_NAMEZENDPOINTr   r   r   r   r   u  s
    r   );enumosobjectr   r   r   r   r    r'   r)   r+   r4   rL   EnumrP   rU   rV   rX   r]   rb   ra   rc   ZDatasetMetaFormatsrd   rf   rj   rl   rr   rv   r   ZREPO_TYPE_MODELZREPO_TYPE_DATASETZREPO_TYPE_SUPPORTZDEFAULT_MODEL_REVISIONZMASTER_MODEL_BRANCHZDEFAULT_REPOSITORY_REVISIONZDEFAULT_DATASET_REVISIONZDEFAULT_DATASET_NAMESPACEZ"DEFAULT_DATA_ACCELERATION_ENDPOINTstrenvironrE   lowerr   r   r   r   r   r   r   ZEXTENSIONS_TO_LOADZMETA_FILES_FORMATr   r   r   r   r   ZDEFAULT_MAXCOMPUTE_ENDPOINTr   r   r   r   r   <module>   s    /4.			