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 json | |
| from groq import Groq | |
| def get_language_code(text: str, api_key: str = None) -> str: | |
| """ | |
| Identify the RFC 5646 language code of given text using Groq API. | |
| Args: | |
| text: The text to identify |
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
| # ========================================================================= | |
| # A simple PyTorch example that learns y = x^2 | |
| # ========================================================================= | |
| #!/usr/bin/env -S uv run | |
| # /// script | |
| # requires-python = ">=3.9" | |
| # dependencies = [ | |
| # "torch", | |
| # "matplotlib", | |
| # "numpy", |
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
| # Generated with Claude 3.5 Sonnet using vgel's r1.py script + the following prompt: | |
| # "Can you modify this script to improve inference speed on a CPU-only PC?" | |
| # It is possible to define the number of threads (= CPU cores) in the prompt | |
| # Example run : python r1-cpu.py -t 32 "What is 1+1?" --threads 4 | |
| import argparse | |
| import random | |
| import sys | |
| from transformers import AutoModelForCausalLM, AutoTokenizer, DynamicCache |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| from groq import Groq | |
| from datetime import timedelta | |
| def format_time(seconds): | |
| # Ensure the first segment starts at 00:00:00,000 | |
| if float(seconds) < 0.001: | |
| return "00:00:00,000" | |
| time = str(timedelta(seconds=float(seconds))).replace('.', ',')[:-3] | |
| return f"{time:0>12}" |
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 math | |
| import tkinter as tk | |
| from tkinter import filedialog, messagebox | |
| from typing import Dict, Optional | |
| from groq import Groq | |
| import logging | |
| # Configure logging | |
| logging.basicConfig( |
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 | |
| # requires-python = ">=3.13" | |
| # dependencies = [ | |
| # "groq", | |
| # ] | |
| # /// | |
| from groq import Groq | |
| import math | |
| client = Groq() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder