From 554554c5910a121aba958356c7c9a28ed3f57ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sat, 24 Aug 2024 00:48:20 +0800 Subject: [PATCH] fix(examples): conda package name conflict (#701) --- examples/onnx/exporter.py | 12 ++++++++++-- examples/onnx/gpt.py | 3 ++- examples/web/webui.py | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/examples/onnx/exporter.py b/examples/onnx/exporter.py index 2276a7c..351fed1 100644 --- a/examples/onnx/exporter.py +++ b/examples/onnx/exporter.py @@ -1,6 +1,13 @@ +import os, sys + +if sys.platform == "darwin": + os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" + +now_dir = os.getcwd() +sys.path.append(now_dir) + from dataclasses import asdict import argparse -import os import torch from tqdm import tqdm from ChatTTS.model.dvae import DVAE @@ -8,7 +15,8 @@ from ChatTTS.config import Config from vocos import Vocos from vocos.pretrained import instantiate_class import torch.jit as jit -from examples.onnx.gpt import GPT + +from gpt import GPT # disable cuda torch.cuda.is_available = lambda: False diff --git a/examples/onnx/gpt.py b/examples/onnx/gpt.py index c026d1a..42b6a83 100644 --- a/examples/onnx/gpt.py +++ b/examples/onnx/gpt.py @@ -4,7 +4,8 @@ from typing import Tuple import torch import torch.nn as nn from torch.nn.utils.parametrizations import weight_norm -from .modeling_llama import LlamaModel, LlamaConfig + +from modeling_llama import LlamaModel, LlamaConfig class GPT(nn.Module): diff --git a/examples/web/webui.py b/examples/web/webui.py index 267fa6c..5a556b0 100644 --- a/examples/web/webui.py +++ b/examples/web/webui.py @@ -10,8 +10,8 @@ import argparse import gradio as gr -from examples.web.funcs import * -from examples.web.ex import ex +from funcs import * +from ex import ex def main():