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
# 2025 Cavit Erginsoy, MIT License | |
import time | |
from typing import Optional | |
import mlx.core as mx | |
import mlx.nn as nn | |
from transformers import AutoTokenizer, AutoConfig | |
from dataclasses import dataclass | |
from huggingface_hub import hf_hub_download | |
import heapq |
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
Word Ladder puzzles involve transforming a start word into an end word. You are allowed to change only one letter a time and you must keep the number of letters constant. | |
Each time you change one letter the word in the chain must be forming a new word that's valid in English. Plurals are allowed, but not proper nouns. | |
Your task will be to simulate a detailed step-by-step chain of thought reasoning of the transformation process from a start word to the end word of a word ladder. | |
You will be given the word ladder question, as well as the correct solution path. So you don't need to solve the problem, you have the solution already, which should be your 'cheat sheet' to refer to as you go along. | |
Your task is to provide a perfectly simulated chain of thought reasoning exactly in the style of the example below, | |
including considering multiple possibilities, backtracking where needed, validating words, and showing the final path. | |
Remember you're NOT trying to find the shortest path, you're trying to find one path t |
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 transformers import Qwen2VLForConditionalGeneration, AutoTokenizer, AutoProcessor | |
from PIL import Image | |
from pathlib import Path | |
import sys | |
# Toggle to switch between full response and extracted description | |
OUTPUT_FULL_RESPONSE = False | |
# Ensure we're using the MPS device if available |
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 requests | |
import uuid | |
import time | |
import random | |
api_key = "your-stability-api-key" | |
num_batches = 6 # Specify the number of images to generate per API | |
prompt = "Your prompt here" | |
negative_prompt = "optional negative prompt here" # Optional |