dspy.Module

dspy.Module

이 페이지는 DSPy 모든 모듈의 베이스 클래스인 Module을 다뤄요. 프로그램을 구성하는 예측기(predictor)들과 그들이 쓰는 LM을 하나로 묶는 기본 틀이에요. 이 클래스를 상속해 forward를 구현하면 재사용 가능한 프로그램 구성 요소를 만들 수 있어요.

출처: 문서

본문

Module은 DSPy 프로그램의 기본 단위예요. 하위 예측기들을 보관·순회하는 메서드(named_predictors, named_parameters, predictors 등)와 LM 설정(set_lm, get_lm), 상태 저장/복원(save/load, dump_state/load_state) 같은 공통 기능을 제공해요. 아래는 이 클래스가 노출하는 멤버 목록이에요.

::: dspy.Module
    handler: python
    options:
        members:
            - __call__
            - acall
            - batch
            - deepcopy
            - dump_state
            - get_lm
            - inspect_history
            - load
            - load_state
            - map_named_predictors
            - named_parameters
            - named_predictors
            - named_sub_modules
            - parameters
            - predictors
            - reset_copy
            - save
            - set_lm
        show_source: true
        show_root_heading: true
        heading_level: 2
        docstring_style: google
        show_root_full_path: true
        show_object_full_path: false
        separate_signature: false
        inherited_members: true

더 알아보기 (Learn more)