build error

Job failed with exit code: 1. Reason: cache miss: [3/6] WORKDIR /app cache miss: [2/6] RUN apt-get update && apt-get install -y ffmpeg fluidsynth build-essential git && rm -rf /var/lib/apt/lists/* cache miss: [6/6] RUN echo "from fastapi import FastAPI, Request\nfrom fastapi.responses import JSONResponse\nimport torch, base64, tempfile, uuid, os, subprocess\nimport soundfile as sf\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\nimport mido\n\napp = FastAPI()\n\ntokenizer = AutoTokenizer.from_pretrained('/app/model')\nmodel = AutoModelForCausalLM.from_pretrained('/app/model', torch_dtype=torch.float32)\nmodel.to('cpu')\nmodel.eval()\n\ndef save_midi(tokens, path):\n mid = mido.MidiFile()\n track = mido.MidiTrack()\n mid.tracks.append(track)\n for t in tokens:\n if isinstance(t, dict) and 'note' in t:\n track.append(mido.Message('note_on', note=t['note'], velocity=64, time=120))\n track.append(mido.Message('note_off', note=t['note'], velocity=64, time=120))\n mid.save(path)\n\ndef midi_to_wav(midi_path, wav_path):\n subprocess.run(['fluidsynth', '-ni', '/usr/share/sounds/sf2/FluidR3_GM.sf2', midi_path, '-F', wav_path], check=True)\n\n@app.post('/generate')\nasync def generate(request: Request):\n data = await request.json()\n prompt = data.get('prompt', 'energetic EDM with drums and bass')\n max_new = int(data.get('max_new', 256))\n\n inputs = tokenizer(prompt, return_tensors='pt')\n out = model.generate(**inputs, max_new_tokens=max_new)\n decoded = tokenizer.decode(out[0])\n\n tokens = []\n for part in decoded.split():\n if part.startswith('note_'):\n try:\n n = int(part.replace('note_', ''))\n tokens.append({'note': n})\n except:\n pass\n\n midi_path = os.path.join(tempfile.gettempdir(), f'{uuid.uuid4().hex}.mid')\n wav_path = os.path.join(tempfile.gettempdir(), f'{uuid.uuid4().hex}.wav')\n\n save_midi(tokens, midi_path)\n midi_to_wav(midi_path, wav_path)\n\n with open(wav_path, 'rb') as f:\n b64 = base64.b64encode(f.read()).decode('ascii')\n\n os.remove(midi_path)\n os.remove(wav_path)\n\n return JSONResponse({'wav_base64': b64, 'sample_rate': 44100})\n\n@app.get('/')\nasync def root():\n return {'status': 'ok'}\n" > app.py cache miss: [4/6] RUN pip install --no-cache-dir fastapi uvicorn[standard] torch transformers huggingface_hub soundfile mido numpy cache miss: [5/6] RUN python3 - << 'EOF' {"total":10,"completed":9,"user_total":6,"user_cached":0,"user_completed":5,"user_cacheable":5,"from":1,"miss":5,"client_duration_ms":100899}

Build logs:

Fetching error logs...