https://huggingface.co/deepseek-ai/DeepSeek-OCR
在大语言模型(LLM)处理长文本时面临的计算挑战日益凸显,DeepSeek-AI团队提出了一个创新性的解决方案——DeepSeek-OCR。这项研究探索了通过视觉模态实现文本信息高效压缩的可行性,为解决长上下文处理问题开辟了全新的技术路径。
python展开代码import requests
import json
import os
from tqdm import tqdm
import time
class FishAudioTTS:
def __init__(self, api_key, reference_id):
"""
初始化Fish Audio TTS客户端
Args:
api_key (str): Fish Audio API密钥
reference_id (str): 参考音频ID
"""
self.api_key = api_key
self.reference_id = reference_id
self.base_url = "https://api.fish.audio/v1/tts"
self.headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json',
'model': 's1' # 使用s1模型
}
def text_to_speech(self, text, output_file="output.wav", **kwargs):
"""
将文本转换为语音
Args:
text (str): 要转换的文本
output_file (str): 输出音频文件名
**kwargs: 其他API参数
"""
# 默认参数
default_params = {
"text": text,
"reference_id": self.reference_id, # 使用参考音频ID
"temperature": 0.7,
"top_p": 0.7,
"chunk_length": 200,
"normalize": True,
"format": "wav",
"sample_rate": 44100,
"latency": "normal"
}
# 合并用户提供的参数
params = {**default_params, **kwargs}
print(f"🎵 开始文本转语音...")
print(f"📝 文本内容: {text[:50]}{'...' if len(text) > 50 else ''}")
print(f"🎯 参考音频ID: {self.reference_id}")
print(f"🤖 使用模型: s1")
try:
# 发送请求
with tqdm(desc="🚀 发送请求到Fish Audio API", unit="req") as pbar:
response = requests.post(
self.base_url,
headers=self.headers,
json=params,
timeout=60
)
pbar.update(1)
# 检查响应状态
if response.status_code == 200:
print("✅ API请求成功!")
# 保存音频文件
with tqdm(desc="💾 保存音频文件", unit="B", unit_scale=True) as pbar:
with open(output_file, "wb") as f:
for chunk in response.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
pbar.update(len(chunk))
print(f"🎉 音频文件已保存到: {output_file}")
print(f"📊 文件大小: {os.path.getsize(output_file)} 字节")
return True
elif response.status_code == 401:
print("❌ 认证失败: API密钥无效")
return False
elif response.status_code == 402:
print("❌ 支付失败: 账户余额不足")
return False
elif response.status_code == 422:
print("❌ 请求参数错误")
try:
error_info = response.json()
print(f"错误详情: {error_info}")
except:
print(f"响应内容: {response.text}")
return False
else:
print(f"❌ 请求失败: HTTP {response.status_code}")
print(f"响应内容: {response.text}")
return False
except requests.exceptions.Timeout:
print("❌ 请求超时,请检查网络连接")
return False
except requests.exceptions.RequestException as e:
print(f"❌ 网络请求错误: {e}")
return False
except Exception as e:
print(f"❌ 未知错误: {e}")
return False
def main():
"""主函数 - 演示Fish Audio TTS的使用"""
# 配置信息
API_KEY = "xx"
REFERENCE_ID = "ef45348243c74d0d83ceb0f2f90c2d38" # 参考音频ID
# 创建TTS客户端
tts_client = FishAudioTTS(API_KEY, REFERENCE_ID)
# 测试文本
test_text = "你好,这是一个使用Fish Audio API的文本转语音测试。今天天气真不错,希望你能喜欢这个声音效果!"
print("=" * 60)
print("🎤 Fish Audio 文本转语音测试")
print("=" * 60)
# 执行文本转语音
success = tts_client.text_to_speech(
text=test_text,
output_file="fish_audio_output.wav",
# 可以自定义参数
temperature=0.8,
top_p=0.8,
format="wav",
sample_rate=44100
)
if success:
print("\n🎉 文本转语音完成!")
print(f"📁 输出文件: fish_audio_output.wav")
else:
print("\n❌ 文本转语音失败,请检查错误信息")
if __name__ == "__main__":
main()
GPT-SoVITS v4出来好久了,使用一下。
代码
bash展开代码git cl
服务:
bash展开代码python -m vllm.entrypoints.openai.api
关键点: 这个测试会让GPU"吃饱",充分利用显卡算力,最能反映显卡的计算性能差异。
找到带 launcher.py 参数的 python 进程 全部杀死
js展开代码sudo pkill -9 -f launcher.py
下载模型
python展开代码curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install git-lfs
git clone https://huggingface.co/Qwen/Qwen2.5-3B-Instruct
模型路径:
bash展开代码/mnt/jfs6/model/Qwen2.5-3B-Instruct
根据搜索结果,启动 GGUF 文件为 OpenAI 式接口主要有以下几种方法:
这是最常用的方法,llama-cpp-python 提供了一个网络服务器,可以作为 OpenAI API 的直接替代品。
安装和启动:
bash展开代码# 安装服务器版本
pip install 'llama-cpp-python[server]' # 无gpu支持
# 或者安装GPU支持的
# NVIDIA GPU (CUDA)
CMAKE_ARGS="-DGGML_CUDA=on" pip install llama-cpp-python[server]
# 启动服务器
python3 -m llama_cpp.server \
--model /mnt/jfs6/model/Satyr-V0.1-4B/Satyr-V0.1-4B-F16.gguf \
--host 0.0.0.0 \
--port 8000 \
--n_ctx 10240 \
--n_gpu_layers -1 # 全部层都放gpu