|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""Metric configurations for the tokenizer model. |
|
|
|
|
|
Support for PSNR or SSIM, there are validation only metrics. |
|
|
""" |
|
|
import attrs |
|
|
|
|
|
from cosmos_predict1.tokenizer.training.metrics import CodeUsageMetric, PSNRMetric, SSIMMetric, TokenizerMetric |
|
|
from cosmos_predict1.utils.lazy_config import LazyCall as L |
|
|
from cosmos_predict1.utils.lazy_config import LazyDict |
|
|
|
|
|
|
|
|
@attrs.define(slots=False) |
|
|
class Metric: |
|
|
|
|
|
PSNR: LazyDict = L(PSNRMetric)() |
|
|
SSIM: LazyDict = L(SSIMMetric)() |
|
|
|
|
|
|
|
|
@attrs.define(slots=False) |
|
|
class DiscreteTokenizerMetric: |
|
|
|
|
|
PSNR: LazyDict = L(PSNRMetric)() |
|
|
SSIM: LazyDict = L(SSIMMetric)() |
|
|
CodeUsage: LazyDict = L(CodeUsageMetric)(codebook_size=64000) |
|
|
|
|
|
|
|
|
MetricConfig: LazyDict = L(TokenizerMetric)(config=Metric()) |
|
|
|
|
|
DiscreteTokenizerMetricConfig: LazyDict = L(TokenizerMetric)(config=DiscreteTokenizerMetric()) |
|
|
|