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
| """ | |
| WARNING: This is an experimental implementation. Expect rough edges while using it. | |
| ------------------------------------------------- | |
| Defines a FastMCP server that exposes the Hugging Face Hub API as a set of tools. | |
| In practice, all public methods from `HfApi` are exposed as tools, except for the ones dealing with files: | |
| - `create_commit` | |
| - `hf_hub_download` | |
| - `preupload_lfs_files` |
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 | |
| from google import genai | |
| from google.genai import types | |
| client = genai.Client(api_key=os.getenv("GEMINI_API_KEY","xxx")) | |
| # Repalce with the youtube url you want to analyze | |
| youtube_url = "https://www.youtube.com/watch?v=RDOMKIw1aF4" | |
| # Prompt to analyze and summarize the Youtube Video |
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 typing import Dict, Union | |
| from huggingface_hub import get_safetensors_metadata | |
| import argparse | |
| import sys | |
| # Example: | |
| # python get_gpu_memory.py Qwen/Qwen2.5-7B-Instruct | |
| # Dictionary mapping dtype strings to their byte sizes | |
| bytes_per_dtype: Dict[str, float] = { |
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
| # train_grpo.py | |
| import re | |
| import torch | |
| from datasets import load_dataset, Dataset | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| from peft import LoraConfig | |
| from trl import GRPOConfig, GRPOTrainer | |
| # Load and prep dataset |