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

PydanticUserError in schema.py #256

Open
AsafKov opened this issue Feb 17, 2024 · 1 comment
Open

PydanticUserError in schema.py #256

AsafKov opened this issue Feb 17, 2024 · 1 comment

Comments

@AsafKov
Copy link

AsafKov commented Feb 17, 2024

Description

In tutorial0 (or wherever Plugins is used) I encounter the following error:
A non-annotated attribute was detected: protected_cols = ['seq_id']. All model fields require a type annotation; if protected_cols is not meant to be a field, you may be able to resolve this error by annotating it as a ClassVar or updating model_config['ignored_types'].

protected_cols is defined in schema.py:
`class Schema(BaseModel):
"""
.. inheritance-diagram:: synthcity.plugins.core.schema.Schema
:parts: 1

Utility class for defining the schema of a Dataset.

Constructor Args:
    domain: Dict
        A dictionary of feature_name: Distribution.
    sampling_strategy: str
        Taking value of "marginal" (default) or "uniform" (for debugging).
    protected_cols: List[str]
        List of columns that are exempt from distributional constraints (e.g. ID column)
    random_state: int
        Random seed (default 0)
    data: Any
        (Optional) the data set
"""

sampling_strategy: str = "marginal"  # uniform or marginal
protected_cols = ["seq_id"]
random_state: int = 0
data: Any = None
domain: Dict = {}`

How to Reproduce

Clone repository, install synthcity and run tutorial0 or import Plugins.

Expected Behavior

Screenshots

System Information

  • OS: Windows
  • OS Version: 11
  • Language Version: Python 3.11.8
  • Package Manager Version:
  • Browser (if applicable):
  • Browser Version (if applicable):

Additional Context

Add any other context about the problem here.

@7Dt3V5TmzAtfur
Copy link

import pydantic
print(pydantic.version)

try pip install pydantic==1.10.15

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

No branches or pull requests

2 participants