[FEATURE] Implement export service - #56
Conversation
|
Now this PR Fixes #31 as well. GGUF Export Flow: flowchart TD
A[User requests GGUF export] --> B{GGUF in Firestore?}
B -- Yes --> C[Return GGUF path]
B -- No --> D{Merged model in Firestore?}
D -- Yes --> E[Download merged model]
E --> F[Convert to GGUF]
F --> G[Push GGUF to bucket]
G --> H[Update Firestore with GGUF]
H --> I[Cleanup temp files]
I --> J[Return GGUF path]
D -- No --> K{Adapters in Firestore?}
K -- No --> L[Return Error]
K -- Yes --> M[Merge base model + adapters]
M --> N[Upload merged model to bucket]
N --> O[Update Firestore with merged model]
O --> P[Use local merged model to convert GGUF]
P --> Q[Push GGUF to bucket]
Q --> R[Update Firestore with GGUF]
R --> S[Cleanup merged model + GGUF]
S --> T[Return GGUF path]
|
|
So the limit is 16GB. |
463ced1 to
8ab0a53
Compare
| "--outfile", | ||
| output_file, | ||
| "--outtype", | ||
| "q8_0", # Default quantization |
There was a problem hiding this comment.
Does this quantisation work on both unsloth and HF models because there might be nuances with quantisation. Plus, can we let the user configure quantisation because the training service supports choosing gguf_quantization from a list of 4-5 common options. We should definitely support q4_k quants for example.
There was a problem hiding this comment.
I tried doing this on google colab. The issue is the training method, model and provider heavly affect which quantizatiosn are available.
We'll have to first curate a permutation of all the quantizations available according to which options were selected. I guess that can be a different PR altogether, focusing on research main.
I did try the q8_0 quantization on both type of models, and they worked. However I'm not sure if models of different sizes will change this behaviour. I hope not.
| from typing import Literal, Optional | ||
|
|
||
|
|
||
| class ExportRequest(BaseModel): |
There was a problem hiding this comment.
Since if the job contains the export type already we dont want to create a new one, make sure the frontend displays the existing export options already and disallow the user to reselect an option that exists (since the frontend has the job data as well)
|
I think the following two features would be cool to add:
However, if the current service already works they can be in a separate PR or a future feature, but both are tied with deployment so might as well ship them? #28 |
|
Currently while testing merging the model, there seems to be an issue I'm not able to fix. At this point I have zero clue what might have caused this. Testing information: Model I was trying to merge: Error: In case you're wondering, here's the input request payload: You can reproduce this issue simply by heading to our export service at https://export-service-10987549752.us-central1.run.app/docs. The application is live right now. My investigation: I didn't found anything in the docs or from AI. There's this GitHub issue I found, but it has 0 help as well: unslothai/unsloth#2238 Moreover, I also found this Discord thread, but at the end, they're just updating unsloth, so I'm not sure if it'll work. You can try to upgrade and rebuild the image though. |
|
@supreme-gg-gg can you investigate in this? |
I have never seen this before, no idea what's going on... I recommend trying with another training job / create a new simple job, or if it doesn't work just test on colab. i think you should report to unsloth probably if it still errors since GGUF seems to be something they actively work on? |
|
Still getting this issue on a different job. Will go ahead and report the bug to Unsloth, and do some experiments on google colab. |
- remove workspaces from root pyproject.toml - re-initialize root uv.lock - initialize export uv.lock - make necessary changes in export Dockerfile
unsloth didn't support loading adapters directly through google cloud bucket public link, so we're now first downloading the adapters and using them
Migrate from pure fastapi service to fastapi service + cloud run jobs
|
@inclinedadarsh I think we can merge the export service with training service? It seems to only contain two endpoints and they are very short lightweight executions, might be easier to manage if we put them together + they're related and pretty much identical in structure |
NOTE: The API doesn't work at this commit because the schema hasn't been utilized yet.
import logger from utils and reuse it
[FEATURE] Support HF exports
Add Export Service for Fine-tuned Gemma Models
Fixes #43
This PR adds a new export service that allows users to export their completed training jobs in various formats.
Features
gs://gemma-export-bucket/merged_models/{job_id}/