MCPcopy Create free account
hub / github.com/ace-step/ACE-Step / __init__

Method __init__

trainer-api.py:36–59  ·  view source on GitHub ↗
(self, checkpoint_dir: str, device: str = "cuda")

Source from the content-addressed store, hash-verified

34
35class InferencePipeline:
36 def __init__(self, checkpoint_dir: str, device: str = "cuda"):
37 self.device = torch.device(device if torch.cuda.is_available() else "cpu")
38 logger.info(f"Initializing model on device: {self.device}")
39
40 # Load the ACEStepPipeline
41 self.acestep_pipeline = ACEStepPipeline(checkpoint_dir)
42 self.acestep_pipeline.load_checkpoint(checkpoint_dir)
43
44 # Initialize components
45 self.transformers = self.acestep_pipeline.ace_step_transformer.float().to(self.device).eval()
46 self.dcae = self.acestep_pipeline.music_dcae.float().to(self.device).eval()
47 self.text_encoder_model = self.acestep_pipeline.text_encoder_model.float().to(self.device).eval()
48 self.text_tokenizer = self.acestep_pipeline.text_tokenizer
49
50 # Ensure no gradients are computed
51 self.transformers.requires_grad_(False)
52 self.dcae.requires_grad_(False)
53 self.text_encoder_model.requires_grad_(False)
54
55 # Initialize scheduler
56 self.scheduler = FlowMatchEulerDiscreteScheduler(
57 num_train_timesteps=1000,
58 shift=3.0,
59 )
60
61 def get_text_embeddings(self, texts, device, text_max_length=256):
62 inputs = self.text_tokenizer(

Callers

nothing calls this directly

Calls 3

ACEStepPipelineClass · 0.90
load_checkpointMethod · 0.80

Tested by

no test coverage detected