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 | |
from torch.utils.data import Dataset, DataLoader | |
import pandas as pd | |
from io import StringIO | |
from sklearn.preprocessing import LabelEncoder | |
# Define a dataset class | |
class CustomDataset(Dataset): | |
def __init__(self, features, labels): |
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
accelerate==0.25.0 | |
ai-dive==0.0.1 | |
aiohttp==3.9.1 | |
aiosignal==1.3.1 | |
async-timeout==4.0.3 | |
attrs==23.1.0 | |
certifi==2023.7.22 | |
charset-normalizer==3.3.2 | |
datasets==2.14.5 | |
dill==0.3.7 |
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 langchain.llms import CTransformers | |
from langchain.callbacks.base import BaseCallbackHandler | |
# Handler that prints each new token as it is computed | |
class NewTokenHandler(BaseCallbackHandler): | |
def on_llm_new_token(self, token: str, **kwargs) -> None: | |
print(f"{token}", end="", flush=True) | |
# Local CTransformers wrapper for Llama-2-7B-Chat | |
llm = CTransformers( |
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
// Read data into buffer | |
let path = std::path::Path::new("/path/to/your/file.zip"); | |
let buffer: Vec<u8> = std::fs::read(path)?; | |
println!("Uploading {} bytes from {:?}", buffer.len(), path); | |
// Create the struct to hold onto and update the progress | |
let upload_progress = indicatif::ProgressBar::new(buffer.len() as u64); | |
let cursor = std::io::Cursor::new(Vec::from(buffer)); | |
let upload_source = ReadProgress { |