[BUG] unable to compile f3 in torch.compile tutorial

オープン
#3,551 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python, pytorch
領域
documentation

調査の方向性

torch_compile_tutorial.html の例から始め、compile_f3 = torch.compile(f3) を含むセルを実行し、報告された Ubuntu または Colab 環境で InternalTorchDynamoError を再現します。traceback に示されている scipy fft と array_api_compat の箇所を通じて失敗を追跡します。チュートリアルのセルがこのエラーなしで実行され、期待される出力が文書化または復元されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug torch.compile
Add Link

https://docs.pytorch.org/tutorials/intermediate/torch_compile_tutorial.html

Describe the bug

When I run the cell

compile_f3 = torch.compile(f3)
print("compile 3:", test_fns(f3, compile_f3, (inp2,)))

in the tutorial, I get the warnings show in the tutorial, but also an error

InternalTorchDynamoError: AttributeError: 'str' object has no attribute 'IF_NEEDED'

from user code:
   File "/home/tiago/miniforge3/envs/pytorch/lib/python3.12/site-packages/scipy/fft/_realtransforms_backend.py", line 15, in torch_dynamo_resume_in__execute_at_12
    return xp.asarray(y)
  File "/home/tiago/miniforge3/envs/pytorch/lib/python3.12/site-packages/scipy/_lib/array_api_compat/numpy/_aliases.py", line 113, in asarray
    return np.array(obj, copy=copy, dtype=dtype, **kwargs)  # pyright: ignore

This also happened when I ran the tutorial in Google Colab.

Describe your environment
  • Plataform: Ubuntu 24.04.3
  • CUDA 12.9
  • pytorch 2.7.1

cc @williamwen42 @msaroufim @anijain2305

主要言語
Python
スター
9.5k
フォーク
4.5k
平均マージ
1日 20時間
マージ済み PR(30日)
2

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pytorch/tutorials のほかの issue

pytorch/tutorials の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。