Text Generation
Transformers
PyTorch
chemistry
biology
finance
legal
music
art
code
climate
medical
text-generation-inference
Merge
Mixture of Experts
Instructions to use ZeppelinCorp/Charm_10 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ZeppelinCorp/Charm_10 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ZeppelinCorp/Charm_10")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ZeppelinCorp/Charm_10", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ZeppelinCorp/Charm_10 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ZeppelinCorp/Charm_10" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ZeppelinCorp/Charm_10", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ZeppelinCorp/Charm_10
- SGLang
How to use ZeppelinCorp/Charm_10 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ZeppelinCorp/Charm_10" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ZeppelinCorp/Charm_10", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ZeppelinCorp/Charm_10" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ZeppelinCorp/Charm_10", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ZeppelinCorp/Charm_10 with Docker Model Runner:
docker model run hf.co/ZeppelinCorp/Charm_10
File size: 2,061 Bytes
18fa92b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | import numpy as np
import librosa
import librosa.display
import torch
import torchaudio
import torchaudio.transforms as T
from pydub import AudioSegment
from transformers import pipeline
import scipy.signal
from speechbrain.pretrained import EncoderClassifier
# Load Audio File
def load_audio(file_path, target_sr=16000):
y, sr = librosa.load(file_path, sr=target_sr)
return y, sr
# Noise Reduction using Spectral Subtraction
def reduce_noise(y, sr):
reduced_noise = scipy.signal.medfilt(y, kernel_size=3)
return reduced_noise
# Convert Speech to Text (ASR)
def speech_to_text(file_path):
asr_model = pipeline("automatic-speech-recognition", model="openai/whisper-small")
transcript = asr_model(file_path)
return transcript["text"]
# Emotion Detection from Voice
def detect_emotion(file_path):
classifier = EncoderClassifier.from_hparams(source="speechbrain/emotion-recognition-wav2vec2",
savedir="pretrained_models/emotion-recognition")
signal, sr = torchaudio.load(file_path)
emotion = classifier.classify_batch(signal)
return emotion[3] # Returns predicted emotion
# Sound Classification (e.g., Speech, Music, Noise)
def classify_sound(file_path):
classifier = EncoderClassifier.from_hparams(source="speechbrain/sound-classification",
savedir="pretrained_models/sound-classification")
signal, sr = torchaudio.load(file_path)
category = classifier.classify_batch(signal)
return category[3] # Returns predicted sound category
# Save Processed Audio
def save_audio(y, sr, output_path):
librosa.output.write_wav(output_path, y, sr)
# Audio Feature Extraction for AI Model Input
def extract_features(file_path):
y, sr = librosa.load(file_path, sr=16000)
mfccs = librosa.feature.mfcc(y=y, sr=sr, n_mfcc=13)
chroma = librosa.feature.chroma_stft(y=y, sr=sr)
mel_spec = librosa.feature.melspectrogram(y=y, sr=sr)
return {"mfccs": mfccs, "chroma": chroma, "mel_spec": mel_spec} |