Skip to content

Commit

Permalink
Create dummy habana_frameworks.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaksymczuk committed Sep 3, 2024
1 parent 6ec20c3 commit c9babcc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions vllm/cpu_migration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import sys
import types

# Create dummy habana_frameworks
habana_frameworks = sys.modules['habana_frameworks'] = types.ModuleType('habana_frameworks')
torch = sys.modules['habana_frameworks.torch'] = types.ModuleType('habana_frameworks.torch')
core = sys.modules['habana_frameworks.torch.core'] = types.ModuleType('habana_frameworks.torch.core')

habana_frameworks.torch = torch
torch.core = core
core.mark_step = lambda: print('calling mark_step')

import habana_frameworks.torch as htorch
import torch

# torch.hpu = sys.modules['torch.hpu'] = types.ModuleType('torch.hpu')
# torch.hpu.synchronize = lambda: print('calling synchronize')

class CpuMigration:
def __init__(self):
self._migrate_to_cpu()
Expand Down

0 comments on commit c9babcc

Please sign in to comment.