This file contains 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
# coding=utf-8 | |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
This file contains 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
#!/bin/bash | |
### steps #### | |
# verify the system has a cuda-capable gpu | |
# download and install the nvidia cuda toolkit and cudnn | |
# setup environmental variables | |
# verify the installation | |
### | |
### to verify your gpu is cuda enable check |
This file contains 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
#!/bin/bash | |
### steps #### | |
# verify the system has a cuda-capable gpu | |
# download and install the nvidia cuda toolkit and cudnn | |
# setup environmental variables | |
# verify the installation | |
### | |
### to verify your gpu is cuda enable check |
This file contains 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 time | |
from typing import Optional, Tuple | |
import torch | |
from PIL import Image | |
import onnxruntime as onnxrt | |
import requests | |
from transformers import AutoConfig, AutoModelForVision2Seq, TrOCRProcessor, VisionEncoderDecoderModel |
This file contains 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
#!/bin/bash | |
### steps #### | |
# verify the system has a cuda-capable gpu | |
# download and install the nvidia cuda toolkit and cudnn | |
# setup environmental variables | |
# verify the installation | |
### | |
### to verify your gpu is cuda enable check |
This file contains 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 math | |
from typing import Callable, Optional | |
from warnings import warn | |
import torch | |
from torch import Tensor | |
from torchaudio import functional as F | |
from torchaudio.compliance import kaldi | |
This file contains 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 requests | |
import math | |
import pandas as pd | |
import flatten_json | |
# instalar flatten_json con: pip install flatten_json | |
# Referencia: https://github.com/amirziai/flatten | |
# parámetros | |
url_api_productos_contar = "https://api.jumpseller.com/v1/products/count.json" |
This file contains 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 tensorflow as tf | |
# FIXME: audio_ops.decode_wav is deprecated, use tensorflow_io.IOTensor.from_audio | |
from tensorflow.contrib.framework.python.ops import audio_ops | |
# Enable eager execution for a more interactive frontend. | |
# If using the default graph mode, you'll probably need to run in a session. | |
tf.enable_eager_execution() | |
@tf.function | |
def audio_to_mfccs( |
This file contains 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 tensorflow as tf | |
from open_seq2seq.utils.utils import get_base_config, check_logdir, create_model | |
# Change with your configs here | |
args_S2T = ["--config_file=/data/training/v5/config-J5x3.py", | |
"--mode=interactive_infer", | |
"--logdir=/data/training/v5/models", | |
"--batch_size_per_gpu=10", | |
] |
This file contains 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 tensorflow as tf | |
trained_checkpoint_prefix = 'checkpoints/dev' | |
export_dir = os.path.join('models', '0') # IMPORTANT: each model folder must be named '0', '1', ... Otherwise it will fail! | |
loaded_graph = tf.Graph() | |
with tf.Session(graph=loaded_graph) as sess: | |
# Restore from checkpoint | |
loader = tf.train.import_meta_graph(trained_checkpoint_prefix + '.meta') |
NewerOlder