This file contains hidden or 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 pandas as pd | |
import time | |
csv = "file.csv" | |
for i in range(10): | |
row = pd.DataFrame([{"time": pd.Timestamp.now(), "data": i}]) | |
time.sleep(0.5) | |
if i == 9: |
This file contains hidden or 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 transformers import AutoModelForCausalLM, AutoTokenizer | |
import torch | |
from transformers import set_seed | |
checkpoint = "meta-llama/Meta-Llama-3-8B-Instruct" | |
device = "cuda" | |
tokenizer = AutoTokenizer.from_pretrained(checkpoint) | |
model = AutoModelForCausalLM.from_pretrained(checkpoint, torch_dtype=torch.bfloat16, device_map="auto").to(device) | |
model.eval() |
This file contains hidden or 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 multiprocessing | |
import time | |
inputs = ["a", "b", "c", "d"] | |
def slow_func(x: str) -> str: | |
print(f"converting {x} to {x + x}...") | |
time.sleep(1) | |
return x + x |