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
| You are Grok 2, a curious AI built by xAI. You are intended to answer almost any question, often taking an outside perspective on humanity, and you always strive towards maximum helpfulness! | |
| Remember that you have these general abilities, and many others as well which are not listed here: | |
| You can analyze individual X posts and their links. | |
| You can answer questions about user profiles on X. | |
| You can analyze content uploaded by user including images and pdfs. | |
| You have realtime access to the web and posts on X. | |
| Remember these are some of the abilities that you do NOT have: |
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 diffusers.utils import export_to_video | |
| from diffusers import LTXPipeline, LTXVideoTransformer3DModel, GGUFQuantizationConfig | |
| ckpt_path = ( | |
| "https://huggingface.co/city96/LTX-Video-gguf/blob/main/ltx-video-2b-v0.9-Q3_K_S.gguf" | |
| ) | |
| transformer = LTXVideoTransformer3DModel.from_single_file( | |
| ckpt_path, | |
| quantization_config=GGUFQuantizationConfig(compute_dtype=torch.bfloat16), |
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 flask import Flask, redirect, request, Response | |
| import requests | |
| app = Flask(__name__) | |
| @app.route('/v2/<namespace>/<name>/blobs/<sha>', methods=['GET', "HEAD"]) | |
| def blobs(namespace, name, sha): | |
| oid = sha.split(':')[1] | |
| r = requests.get(f'https://huggingface.co/api/models/{namespace}/{name}/tree/main') | |
| result = r.json() |
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 huggingface_hub import HfApi | |
| from huggingface_hub import logging | |
| logging.set_verbosity_info() | |
| api = HfApi() | |
| api.upload_folder(folder_path="<FOLDER NAME>", | |
| repo_id="<DATASET NAME>", | |
| repo_type="dataset", |
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 transformers | |
| model_name = 'Intel/neural-chat-7b-v3-1' | |
| model = transformers.AutoModelForCausalLM.from_pretrained(model_name) | |
| tokenizer = transformers.AutoTokenizer.from_pretrained(model_name) | |
| def generate_response(system_input, user_input): | |
| # Format the input using the provided template |
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 json | |
| import time | |
| import torch | |
| from transformers import pipeline | |
| pipe = pipeline( | |
| "automatic-speech-recognition", | |
| "openai/whisper-large-v3", | |
| torch_dtype=torch.float16, | |
| device="mps", |
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 json | |
| import argparse | |
| import torch | |
| from transformers import pipeline | |
| parser = argparse.ArgumentParser(description="Automatic Speech Recognition") | |
| parser.add_argument( | |
| "--file-name", | |
| required=True, |
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
| !pip install transformers optimum | |
| !pip install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model_name_or_path = "TheBloke/zephyr-7B-beta-GPTQ" | |
| model = AutoModelForCausalLM.from_pretrained(model_name_or_path, | |
| device_map="auto", | |
| trust_remote_code=False, |
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
| # Load the dataset (locally) | |
| from datasets import load_dataset | |
| cv_11 = load_dataset("mozilla-foundation/common_voice_11_0", "hi", split="train") | |
| # Stream the dataset | |
| from datasets import load_dataset |
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
| #pip install git+https://github.com/huggingface/transformers.git | |
| import datetime | |
| import sys | |
| from transformers import pipeline | |
| from transformers.pipelines.audio_utils import ffmpeg_microphone_live | |
| pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=0) | |
| sampling_rate = pipe.feature_extractor.sampling_rate |