This file has been truncated, but you can view the full file.
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
[ | |
"<s>", | |
"<pad>", | |
"</s>", | |
"<unk>", | |
",", | |
".", | |
"▁", | |
"s", | |
"▁de", |
This file has been truncated, but you can view the full file.
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
[ | |
"<s>", | |
"<pad>", | |
"</s>", | |
"<unk>", | |
",", | |
".", | |
"▁", | |
"s", |
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 csv | |
from reportlab.lib.pagesizes import landscape | |
from reportlab.platypus import SimpleDocTemplate, Paragraph, Image, PageBreak | |
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle | |
from reportlab.lib import colors | |
from reportlab.platypus import Table, TableStyle | |
from reportlab.lib.units import inch | |
from PIL import Image as PILImage | |
from io import BytesIO | |
from pathlib import Path |
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 datasets import load_dataset | |
from torch.utils.data import Dataset | |
from pathlib import Path | |
from diffusers import DiffusionPipeline, FluxTransformer2DModel, AutoencoderKL | |
from transformers import T5EncoderModel, CLIPTextModel | |
from torchao.quantization import quantize_, int8_weight_only | |
import time | |
import csv | |
from tqdm import tqdm |
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 measure_max_gpu_usage(func): | |
from torch.cuda import max_memory_allocated, reset_peak_memory_stats | |
def wrapper(*args, **kwargs): | |
reset_peak_memory_stats() | |
result = func(*args, **kwargs) | |
max_memory = max_memory_allocated() / 1024 / 1024 / 1024 | |
print(f"Maximum GPU Usage: {max_memory:.3f} GB") | |
return result |
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 platform | |
import torch | |
def get_gpu_info(): | |
if torch.cuda.is_available(): | |
return torch.cuda.get_device_name(0) | |
else: | |
return "No CUDA-capable GPU found" |
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
const getUrl = (uri: string): string => { | |
/** | |
* Extracts the bucket and object key from the URI and returns the URL to the object. | |
* @param uri The URI of the object. | |
* @returns The URL to the object. | |
* @example | |
* getUrl('s3://bucket-name/object-key') // 'https://bucket-name.s3.amazonaws.com/object-key' | |
* getUrl('s3://bucket-name/folder/object-key') // 'https://bucket-name.s3.amazonaws.com/folder/object-key' | |
*/ |
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 'package:flutter/material.dart'; | |
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; | |
class InfiniteScrollableTable<T extends Object> extends StatefulWidget { | |
final Future<List<T>> Function(int) fetchPage; | |
final int pageSize; | |
final Widget Function(BuildContext, T, int) itemBuilder; | |
const InfiniteScrollableTable( |
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 pathlib import Path | |
from pydub import AudioSegment | |
def convert_to_wav(audio_path,target_sr=32000): | |
P = Path(audio_path) | |
extension = P.suffix | |
extension = extension[1:] | |
if extension == "wav": | |
return audio_path |
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 boto3 | |
BUCKET_NAMES = [ | |
"buckets", | |
"to", | |
"remove" | |
] | |
for bucket_name in BUCKET_NAMES: | |
s3 = boto3.resource("s3") |
NewerOlder