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]: Depyf prepare_debug attribute not found #75

Open
emmyxth opened this issue Jan 10, 2025 · 1 comment
Open

[Bug]: Depyf prepare_debug attribute not found #75

emmyxth opened this issue Jan 10, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@emmyxth
Copy link

emmyxth commented Jan 10, 2025

Your current environment

The output of `python collect_env.py`

[pip3] depyf==0.18.0+dab83110
[pip3] torch==2.3.1
[conda] pytorch 2.3.1 cpu_py310h0ce1571_0

🐛 Describe the bug

I just ran this:

 C:\Users\Administrator\Desktop\end_to_end>pip install git+https://github.com/thuml/depyf.git
Collecting git+https://github.com/thuml/depyf.git

And then this line of code as suggested in the documentation:

import torch
from torch import _dynamo as torchdynamo
from typing import List

@torch.compile
def toy_example(a, b):
    x = a / (torch.abs(a) + 1)
    if b.sum() < 0:
        b = b * -1
    return x * b

def main():
    for _ in range(100):
        toy_example(torch.randn(10), torch.randn(10))

if __name__ == "__main__":
    # main()
    # surround the code you want to run inside `with depyf.prepare_debug`
    import depyf
    with depyf.prepare_debug("./dump_src_dir"):
        main()

Which led to this error:

(base): C:\Users\Administrator\Desktop\end_to_end>python depyf.py
Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\end_to_end\depyf.py", line 20, in <module>
    with depyf.prepare_debug("./dump_src_dir"):
AttributeError: module 'depyf' has no attribute 'prepare_debug'

And when I simply try running depyf I get:

 C:\Users\Administrator\Desktop\end_to_end>depyf
(end2end) C:\Users\Administrator\Desktop\end_to_end>
[main 2025-01-10T02:22:31.253Z] Error: Cannot find module 'windows-foreground-love'
Require stack:
- C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js
-
    at Module._resolveFilename (node:internal/modules/cjs/loader:1152:15)
    at s._resolveFilename (node:electron/js2c/browser_init:2:120426)
    at Module._load (node:internal/modules/cjs/loader:993:27)
    at c._load (node:electron/js2c/node_init:2:13801)
    at Module.require (node:internal/modules/cjs/loader:1240:19)
    at require (node:internal/modules/helpers:179:18)
    at m (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:5:98)
    at c.load (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:4:1637)
    at A.load (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:3:14274)
    at D (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:5:9339)
    at Object.errorback (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:5:9458)
    at A.triggerErrorback (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:3:14568)
    at C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:3:14319
    at c.load (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:4:1654)
    at A.load (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:3:14274)
    at D (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:5:9339)
    at r._loadModule (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:5:9467)
    at r._resolve (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:6:452)
    at r.defineModule (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:5:5561)
    at r._relativeRequire (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:5:6185)
    at C (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\main.js:5:8517)
    at C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js:130:310
    at new Promise (<anonymous>)
    at He.i (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js:130:288)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async He.f (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js:129:5391)
    at async C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js:129:1399
    at async He.a (C:\Users\Administrator\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js:129:1286) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Administrator\\AppData\\Local\\Programs\\cursor\\resources\\app\\out\\main.js',
    undefined
  ],
  phase: 'loading',
  moduleId: 'windows-foreground-love',
  neededBy: [ '===anonymous3===' ]
}

@emmyxth emmyxth added the bug Something isn't working label Jan 10, 2025
@youkaichao
Copy link
Member

C:\Users\Administrator\Desktop\end_to_end\depyf.py

it seems you have a file named depyf , and chances are you are importing this file. I think you can try to rename to file.

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

2 participants