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

[BUG] swanlab: Data type error, key: eval_normalized_wer, data type: NoneType, expected: float #760

Open
80boys opened this issue Dec 27, 2024 · 4 comments
Labels
🐛 bug Something isn't working

Comments

@80boys
Copy link

80boys commented Dec 27, 2024

swanlab.init(
    workspace="wuheng0319",
    project="finetuning",
    config={
    "learning_rate": 1e-5,
    "batch_size": 8,
    "epochs": 2,
    "gradient_accumulation_steps": 1,
    }
)

wandb.login(key=WANDB_TOKEN)
wandb.init(project="finetuning", name="training-run", config={
    "learning_rate": 1e-5,
    "batch_size": 8,
    "epochs": 2,
    "gradient_accumulation_steps": 1,
})

image

image


swanlab: Tracking run with swanlab version 0.4.2
swanlab: Run data will be saved locally in /home/utalk/jupyter/TuneWhisper/swanlog/run-20241227_185531-004ddc0c
swanlab: 👋 Hi wuheng0319, welcome to swanlab!
swanlab: Syncing run ox-3 to the cloud
swanlab: 🌟 Run `swanlab watch /home/utalk/jupyter/TuneWhisper/swanlog` to view SwanLab Experiment Dashboard locally
swanlab: 🏠 View project at https://swanlab.cn/@wuheng0319/whisper-finetuning
swanlab: 🚀 View run at https://swanlab.cn/@wuheng0319/whisper-finetuning/runs/sf125vde6npyd78utgc6v
trainable params: 15,728,640 || all params: 1,559,033,600 || trainable%: 1.0088711365810203
swanlab: Data type error, key: eval_loss, data type: NoneType, expected: float
swanlab: Chart 'eval_loss' creation failed. Reason: The expected value type for the chart 'eval_loss' is one of int,float or BaseType, but the input type is NoneType.
swanlab: Data type error, key: eval_wer, data type: NoneType, expected: float
swanlab: Chart 'eval_wer' creation failed. Reason: The expected value type for the chart 'eval_wer' is one of int,float or BaseType, but the input type is NoneType.
swanlab: Data type error, key: eval_normalized_wer, data type: NoneType, expected: float
swanlab: Chart 'eval_normalized_wer' creation failed. Reason: The expected value type for the chart 'eval_normalized_wer' is one of int,float or BaseType, but the input type is NoneType.
{'loss': 5.9328, 'grad_norm': 4.758566379547119, 'learning_rate': 2.0000000000000002e-07, 'epoch': 0.0}
swanlab: Chart 'eval_loss' creation failed. Reason: The expected value type for the chart 'eval_loss' is one of int,float or BaseType, but the input type is NoneType.
swanlab: Chart 'eval_wer' creation failed. Reason: The expected value type for the chart 'eval_wer' is one of int,float or BaseType, but the input type is NoneType.
swanlab: Chart 'eval_normalized_wer' creation failed. Reason: The expected value type for the chart 'eval_normalized_wer' is one of int,float or BaseType, but the input type is NoneType.
{'loss': 5.1045, 'grad_norm': 4.454663276672363, 'learning_rate': 1.8000000000000001e-06, 'epoch': 0.01}
swanlab: Chart 'eval_loss' creation failed. Reason: The expected value type for the chart 'eval_loss' is one of int,float or BaseType, but the input type is NoneType.
swanlab: Chart 'eval_wer' creation failed. Reason: The expected value type for the chart 'eval_wer' is one of int,float or BaseType, but the input type is NoneType.
swanlab: Chart 'eval_normalized_wer' creation failed. Reason: The expected value type for the chart 'eval_normalized_wer' is one of int,float or BaseType, but the input type is NoneType.
{'loss': 5.4229, 'grad_norm': 4.392512798309326, 'learning_rate': 3.4000000000000005e-06, 'epoch': 0.02}
swanlab: Chart 'eval_loss' creation failed. Reason: The expected value type for the chart 'eval_loss' is one of int,float or BaseType, but the input type is NoneType.
swanlab: Chart 'eval_wer' creation failed. Reason: The expected value type for the chart 'eval_wer' is one of int,float or BaseType, but the input type is NoneType.
swanlab: Chart 'eval_normalized_wer' creation failed. Reason: The expected value type for the chart 'eval_normalized_wer' is one of int,float or BaseType, but the input type is NoneType.
{'loss': 5.1348, 'grad_norm': 4.625607013702393, 'learning_rate': 5.400000000000001e-06, 'epoch': 0.02}

我不知道问题出在哪里,但是 wandb 是好用的,而且人家还支持 代码登录 有login 方法

@80boys 80boys added the 🐛 bug Something isn't working label Dec 27, 2024
@80boys
Copy link
Author

80boys commented Dec 27, 2024

class CustomTrainerCallback(TrainerCallback):
    def on_log(self, args, state, control, **kwargs):
        logs = kwargs.get("logs")
        if logs is not None:
            step = state.global_step
            loss = logs.get("loss")
            eval_loss = logs.get("eval_loss")
            eval_wer = logs.get("eval/wer")
            eval_normalized_wer = logs.get("eval/normalized_wer")

            swanlab.log({
                "train_loss": loss,
                "eval_loss": eval_loss,
                "eval_wer": eval_wer,
                "eval_normalized_wer": eval_normalized_wer,
                "step": step
            })
            
            wandb.log({
                "train_loss": loss,
                "eval_loss": eval_loss,
                "eval_wer": eval_wer,
                "eval_normalized_wer": eval_normalized_wer,
                "step": step
            })
        return control
        
    ```
    
    上报代码如上

@Zeyi-Lin
Copy link
Member

Zeyi-Lin commented Dec 27, 2024

Hi,我们在跟踪这个问题,看起来你自定义了一个框架集成类,请问你是用的哪个框架?
此外,swanlab也支持login方法,方式为:

swanlab.login(api_key="[你的API Key]")

@SAKURA-CAT
Copy link
Contributor

SAKURA-CAT commented Dec 28, 2024

{'loss': 5.9328, 'grad_norm': 4.758566379547119, 'learning_rate': 2.0000000000000002e-07, 'epoch': 0.0}

主要您的eval_normalized_wer 并没有在此处打印,我并不清楚他的具体类型是什么——wandb可能考虑的多一些——您愿意提供更多的类型信息吗?

@SAKURA-CAT
Copy link
Contributor

此外根据我的观察,您对比的并不是同一份数据,wandb自动的将eval_normalized_wer归组到了eval/normalized_wer (swanlab没有这个功能,因为我不确定这是否有必要),因此您上传的wandb的图像似乎全部和train相关的。

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants