Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#149] Pipeline - task template #150

Merged
merged 6 commits into from
Feb 4, 2025
Merged

[#149] Pipeline - task template #150

merged 6 commits into from
Feb 4, 2025

Conversation

lovit
Copy link
Owner

@lovit lovit commented Feb 4, 2025

resolve #149

@lovit lovit linked an issue Feb 4, 2025 that may be closed by this pull request
@lovit lovit merged commit d734c4a into feature/146 Feb 4, 2025
2 checks passed
@lovit lovit deleted the feature/149 branch February 4, 2025 18:15
@lovit lovit mentioned this pull request Feb 4, 2025


def from_dict(data: dict) -> Config:
return dacite.from_dict(data_class=Config, data=data) # type: ignore
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# type: ignore 제거 시 pyright failed

soynlp/soynlp/configs/config.py
  soynlp/soynlp/configs/config.py:4:8 - warning: Import "yaml" could not be resolved from source (reportMissingModuleSource)
  soynlp/soynlp/configs/config.py:25:53 - error: Argument of type "dict[Unknown, Unknown]" cannot be assigned to parameter "data" of type "Data" in function "from_dict"
    "dict[Unknown, Unknown]" is incompatible with protocol "Data"
      "keys" is an incompatible type
        Type "() -> dict_keys[Unknown, Unknown]" is not assignable to type "() -> None"
          Function return type "dict_keys[Unknown, Unknown]" is incompatible with type "None"
            "dict_keys[Unknown, Unknown]" is not assignable to "None"
      "__getitem__" is an incompatible type
        Type "(key: Unknown, /) -> Unknown" is not assignable to type "(item: Unknown) -> None"
          Missing keyword parameter "item"
    ... (reportArgumentType)
1 error, 1 warning, 0 informations

yaml.full_load(file) 가 반환하는 값의 타입이 dict[Unknown, Unknown] 으로 추론되기에 data_class 와 타입 불일치가 일어남. 이후에 해결하기 위해 임시로 pyright 체크 과정을 건너 띔

이로 인해 from_yaml 함수의 line 21 에서도 동일한 오류 발생

for task_config in config.pipeline:
task_module = importlib.import_module("soynlp.pipeline.tasks")
task_class: type[Task] = getattr(task_module, f"{task_config.name}Task")
task_args = dacite.from_dict(data_class=task_class.args(), data=task_config.args) # type: ignore
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/lovit/soynlp/pull/150/files#r1941706190 와 동일한 오류 발생. 임시로 무시함

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pipeline template
1 participant