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
source spack/share/spack/setup-env.sh | |
spack load gcc@12.3.0 | |
CMAKE_ARGS="-DLLAMA_CUBLAS=on -DCMAKE_CUDA_ARCHITECTURES=all-major" FORCE_CMAKE=1 pip install llama-cpp-python --force-reinstall --upgrade --no-cache-dir |
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
from datasets import load_dataset, Dataset | |
from trl import SFTTrainer | |
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig, TrainingArguments | |
from peft import LoraConfig | |
import torch, sys | |
dataset = load_dataset("celsowm/auryn", split="train" | |
#, download_mode="force_redownload" | |
) |
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
{ | |
"perguntas_respostas": [ | |
{ | |
"pergunta": "O que é uma procuradoria estadual e qual é o seu papel no sistema jurídico?", | |
"resposta": "Uma procuradoria estadual é um órgão responsável pela representação jurídica do Estado em questões legais. Seu papel inclui a defesa dos interesses e direitos do Estado nas esferas judicial e extrajudicial." | |
}, | |
{ | |
"pergunta": "Quais são as principais funções desempenhadas por uma procuradoria estadual?", | |
"resposta": "As principais funções de uma procuradoria estadual incluem a representação judicial e extrajudicial do Estado, a elaboração de pareceres jurídicos, a condução de processos administrativos e a assessoria aos órgãos públicos estaduais em questões legais." | |
}, |
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 networkx as nx | |
import matplotlib.pyplot as plt | |
def plot_neural_network(entrada, oculta, saida): | |
G = nx.DiGraph() | |
G.add_nodes_from([f'Entrada{i+1}' for i in range(entrada)]) | |
G.add_nodes_from([f'Oculta{i+1}' for i in range(oculta)]) | |
G.add_nodes_from([f'Saida{i+1}' for i in range(saida)]) |
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 torch | |
import torch.nn as nn | |
import pandas as pd | |
# Ler o arquivo CSV | |
df = pd.read_csv('diabetes.csv') | |
# Extrair os dados para feature_set e labels | |
feature_set = torch.tensor(df.drop('diabetico', axis=1).values, dtype=torch.float32) | |
labels = torch.tensor(df['diabetico'].values, dtype=torch.float32) |
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 | |
import pandas as pd | |
# Ler o arquivo CSV | |
df = pd.read_csv('diabetes.csv') | |
# Extrair os dados para feature_set e labels | |
feature_set = df.drop('diabetico', axis=1).values | |
labels = df['diabetico'].values |
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 networkx as nx | |
import matplotlib.pyplot as plt | |
def plot_neural_network(entrada, oculta, saida): | |
G = nx.DiGraph() | |
G.add_nodes_from([f'Entrada{i+1}' for i in range(entrada)]) | |
G.add_nodes_from([f'Oculta{i+1}' for i in range(oculta)]) | |
G.add_nodes_from([f'Saida{i+1}' for i in range(saida)]) |
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
fumante | obeso | pratica_exercicios | diabetico | |
---|---|---|---|---|
0 | 1 | 0 | 1 | |
0 | 0 | 1 | 0 | |
1 | 0 | 0 | 0 | |
1 | 1 | 0 | 1 | |
1 | 1 | 1 | 1 |
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 numpy as np, sys | |
import pandas as pd | |
# Ler o arquivo CSV | |
df = pd.read_csv('diabetes.csv') | |
# Extrair os dados para feature_set e labels | |
feature_set = feature_set = df.drop('diabetico', axis=1).values | |
labels = df['diabetico'].values.reshape(-1, 1) |
NewerOlder