k2-fsa / k2

FSA/FST algorithms, differentiable, with PyTorch compatibility.
https://k2-fsa.github.io/k2
Apache License 2.0
1.08k stars 211 forks source link

Fix building wheels for torch 2.2.0. #1269

Closed csukuangfj closed 4 months ago

csukuangfj commented 4 months ago

See also https://github.com/pytorch/pytorch/issues/120020

We need to use gcc >=9 to build against pytorch 2.2.0


This PR fixes the following issue in icefall https://github.com/k2-fsa/icefall/actions/runs/7947265916/job/21696348146

2024-02-18 08:00:22,637 INFO [train.py:495] device: cpu
2024-02-18 08:00:23,242 INFO [asr_datamodule.py:146] About to get train cuts
2024-02-18 08:00:23,242 INFO [asr_datamodule.py:247] About to get train cuts
2024-02-18 08:00:23,243 INFO [asr_datamodule.py:149] About to create train dataset
2024-02-18 08:00:23,243 INFO [asr_datamodule.py:201] Using SimpleCutSampler.
2024-02-18 08:00:23,243 INFO [asr_datamodule.py:207] About to create train dataloader
2024-02-18 08:00:23,244 INFO [asr_datamodule.py:220] About to get test cuts
2024-02-18 08:00:23,244 INFO [asr_datamodule.py:255] About to get test cuts
Traceback (most recent call last):
  File "./tdnn/train.py", line 575, in <module>
    main()
  File "./tdnn/train.py", line 571, in main
    run(rank=0, world_size=1, args=args)
  File "./tdnn/train.py", line 536, in run
    train_one_epoch(
  File "./tdnn/train.py", line 417, in train_one_epoch
    loss.backward()
  File "/usr/local/lib/python3.8/site-packages/torch/_tensor.py", line 522, in backward
    torch.autograd.backward(
  File "/usr/local/lib/python3.8/site-packages/torch/autograd/__init__.py", line 266, in backward
    Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
  File "/usr/local/lib/python3.8/site-packages/torch/autograd/function.py", line 289, in apply
    return user_fn(self, *args)
  File "/usr/local/lib/python3.8/site-packages/k2/autograd.py", line 116, in backward
    scores_grad = bprop_func(fsas.arcs, arc_post, tot_scores_grad)
RuntimeError: Unknown layout