(request: dict[str, Any])
| 202 | |
| 203 | |
| 204 | def make_generation_params(request: dict[str, Any]) -> GenerationParams: |
| 205 | kwargs = dict(request) |
| 206 | track_name = kwargs.pop("track_name", "") |
| 207 | complete_track_classes = kwargs.pop("complete_track_classes", None) |
| 208 | negative_prompt = kwargs.pop("negative_prompt", None) |
| 209 | if negative_prompt is not None and "lm_negative_prompt" not in kwargs: |
| 210 | kwargs["lm_negative_prompt"] = negative_prompt |
| 211 | if kwargs.get("task_type") == "extract" and track_name and not kwargs.get("instruction"): |
| 212 | kwargs["instruction"] = f"Extract the {track_name.upper()} track from the audio:" |
| 213 | if kwargs.get("task_type") == "lego" and track_name and not kwargs.get("instruction"): |
| 214 | kwargs["instruction"] = f"Generate the {track_name.upper()} track based on the audio context:" |
| 215 | if kwargs.get("task_type") == "complete" and complete_track_classes and not kwargs.get("instruction"): |
| 216 | track_classes = [str(item).upper() for item in complete_track_classes] |
| 217 | kwargs["instruction"] = f"Complete the input track with {' | '.join(track_classes)}:" |
| 218 | return GenerationParams(**kwargs) |
| 219 | |
| 220 | |
| 221 | def make_generation_config(request: dict[str, Any], noise_file: str) -> GenerationConfig: |
no test coverage detected