from diffusers import AutoPipelineForText2Image
import torch
pipeline = AutoPipelineForText2Image.from_pretrained(
"black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16
).to("cuda")
pipeline.load_lora_weights("sayakpaul/yarn_art_lora_flux", weight_name="pytorch_lora_weights.safetensors")
image = pipeline("a puppy in a pond, yarn art style", guidance_scale=3.5, height=768).images[0]
image.save("yarn.png")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| from safetensors.torch import save_file | |
| INPUT_NAME = "model_weights.ckpt" | |
| OUTPUT_NAME = "model.safetensors" | |
| state = torch.load(INPUT_NAME, map_location="cpu") | |
| new_state = {} | |
| for key, value in state.items(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Tailwind CSS LLMs.txt Documentation | |
| > This document provides a comprehensive overview of Tailwind CSS utility classes, examples, and customization options. It covers various CSS properties like layout, spacing, typography, backgrounds, borders, effects, transitions, transforms, and more, explaining how to use Tailwind's utility classes to style web elements effectively and responsively. | |
| This document details the documentation of Tailwind CSS utilities. It explains how Tailwind scans source files for classes, the importance of using complete class names, and how utility classes can be applied conditionally using variants for states (hover, focus), responsive breakpoints, dark mode, and other conditions. It also covers customization via theme variables and adding custom styles. | |
| **Core Concepts (from styling-with-utility-classes.mdx & responsive-design.mdx):** | |
| * **Utility-First:** Style elements by combining many single-purpose utility classes directly in HTML. | |
| * **Constraint-Based:** Utilities general |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Claude Code is a Beta product per Anthropic's Commercial Terms of Service. | |
| // By using Claude Code, you agree that all code acceptance or rejection decisions you make, | |
| // and the associated conversations in context, constitute Feedback under Anthropic's Commercial Terms, | |
| // and may be used to improve Anthropic's products, including training models. | |
| // You are responsible for reviewing any code suggestions before use. | |
| // (c) Anthropic PBC. All rights reserved. Use is subject to Anthropic's Commercial Terms of Service (https://www.anthropic.com/legal/commercial-terms). | |
| // Version: 0.2.9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def generate_speculative( | |
| model: nn.Module, | |
| draft_model: nn.Module, | |
| tokenizer: Union[PreTrainedTokenizer, TokenizerWrapper], | |
| prompt: str, | |
| max_tokens: int = 100, | |
| verbose: bool = False, | |
| formatter: Optional[Callable] = None, | |
| **kwargs, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # dependencies = [ | |
| # "SpeechRecognition", | |
| # "mlx-whisper", | |
| # "pyaudio", | |
| # ] | |
| # /// | |
| import speech_recognition as sr | |
| import numpy as np |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Begin by enclosing all thoughts within <thinking> tags, exploring multiple angles and approaches. | |
| Break down the solution into clear steps within <step> tags. Start with a 20-step budget, requesting more for complex problems if needed. | |
| Use <count> tags after each step to show the remaining budget. Stop when reaching 0. | |
| Continuously adjust your reasoning based on intermediate results and reflections, adapting your strategy as you progress. | |
| Regularly evaluate progress using <reflection> tags. Be critical and honest about your reasoning process. | |
| Assign a quality score between 0.0 and 1.0 using <reward> tags after each reflection. Use this to guide your approach: | |
| 0.8+: Continue current approach | |
| 0.5-0.7: Consider minor adjustments | |
| Below 0.5: Seriously consider backtracking and trying a different approach |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import mlx.core as mx | |
| from mlx_lm import load, generate | |
| filename = os.path.join(os.path.dirname(mx.__file__), "core/__init__.pyi") | |
| with open(filename, 'r') as fid: | |
| prompt = fid.read() | |
| prompt += "\nHow do you write a self-attention layer using the above API in MLX?" | |
| model, tokenizer = load("mlx-community/meta-Llama-3.1-8B-Instruct-4bit") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "last_node_id": 469, | |
| "last_link_id": 1401, | |
| "nodes": [ | |
| { | |
| "id": 16, | |
| "type": "KSamplerSelect", | |
| "pos": [ | |
| -280, | |
| 20 |
macOS Live Text has a very good quality/speed tradeoff.
Compared to Tesseract, it has much higher quality and is up to 3x as fast.
NewerOlder