Run this model with HF Jobs
Run isatis/kw on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/isatis/kw. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/isatis/kw on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use isatis/kw with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use isatis/kw with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("isatis/kw", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
restored handler to a supposed working version
Browse files86 unmodified lines87888990919293130 unmodified lines22422522622722822923023123223323423523630 unmodified lines2672682692702712722733 unmodified lines277278279280281282283284103 unmodified lines38838939039139239339439586 unmodified linesself.total_steps = {}self.inference_in_progress = Falseself.executor = ThreadPoolExecutor(max_workers=1)# load the optimized modelself.pipe = DiffusionPipeline.from_pretrained(130 unmodified lines"""Clean up the data related to a specific request ID."""# Remove the request ID from the progress dictionaryself.inference_progress.clear()# Remove the request ID from the images dictionaryself.inference_images.clear()# Remove the request ID from the total_steps dictionaryself.total_steps.clear()# Set inference to Falseself.inference_in_progress = False30 unmodified linesexcept Exception as e:print(f"Error: {e}")raise# Store progress and imageprogress_percentage = (3 unmodified linesself.inference_progress[request_id] = progress_percentageself.inference_images[request_id] = img_strprint(self.inference_progress)def check_progress(self, request_id: str) -> Dict[str, Union[str, float]]:progress = self.inference_progress.get(request_id, 0)latest_image = self.inference_images.get(request_id, None)103 unmodified linesexcept Exception as e:# Handle any other exceptions and return an error responseprint(f"Error in start inference {e}")raisedef __call__(self, data: Any) -> Dict:"""Handle incoming requests."""86 unmodified lines878889909192939495130 unmodified lines22622722822923023123223323423523623723830 unmodified lines2692702712722732743 unmodified lines278279280281282283103 unmodified lines38738838939039139239386 unmodified linesself.total_steps = {}self.inference_in_progress = Falseself.executor = ThreadPoolExecutor(max_workers=1) # Vous pouvez ajuster max_workers en fonction de vos besoins# load the optimized modelself.pipe = DiffusionPipeline.from_pretrained(130 unmodified lines"""Clean up the data related to a specific request ID."""# Remove the request ID from the progress dictionaryself.inference_progress.pop(request_id, None)# Remove the request ID from the images dictionaryself.inference_images.pop(request_id, None)# Remove the request ID from the total_steps dictionaryself.total_steps.pop(request_id, None)# Set inference to Falseself.inference_in_progress = False30 unmodified linesexcept Exception as e:print(f"Error: {e}")# Store progress and imageprogress_percentage = (3 unmodified linesself.inference_progress[request_id] = progress_percentageself.inference_images[request_id] = img_strdef check_progress(self, request_id: str) -> Dict[str, Union[str, float]]:progress = self.inference_progress.get(request_id, 0)latest_image = self.inference_images.get(request_id, None)103 unmodified linesexcept Exception as e:# Handle any other exceptions and return an error responsereturn {"flag": "error", "message": str(e)}def __call__(self, data: Any) -> Dict:"""Handle incoming requests."""
handler.py+7-9