Update README.md
#3
by csabakecskemeti - opened
25 unmodified lines262728293031323334357 unmodified lines434445464748495025 unmodified linesimport torchfrom transformers import AutoModel, AutoTokenizermodel_path = "apple/DiffuCoder-7B-Instruct"model = AutoModel.from_pretrained(model_path, torch_dtype=torch.bfloat16, trust_remote_code=True)tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)model = model.to("cuda").eval()query = "Write a function to find the shared elements from the given two lists."prompt = f"""<|im_start|>system7 unmodified linesTOKEN_PER_STEP = 1 # diffusion timesteps * TOKEN_PER_STEP = total new tokensinputs = tokenizer(prompt, return_tensors="pt")input_ids = inputs.input_ids.to(device="cuda")attention_mask = inputs.attention_mask.to(device="cuda")output = model.diffusion_generate(input_ids,25 unmodified lines26272829303132333435367 unmodified lines444546474849505125 unmodified linesimport torchfrom transformers import AutoModel, AutoTokenizerdevice = "cuda"model_path = "apple/DiffuCoder-7B-Instruct"model = AutoModel.from_pretrained(model_path, torch_dtype=torch.bfloat16, trust_remote_code=True)tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)model = model.to(device).eval()query = "Write a function to find the shared elements from the given two lists."prompt = f"""<|im_start|>system7 unmodified linesTOKEN_PER_STEP = 1 # diffusion timesteps * TOKEN_PER_STEP = total new tokensinputs = tokenizer(prompt, return_tensors="pt")input_ids = inputs.input_ids.to(device=device)attention_mask = inputs.attention_mask.to(device=device)output = model.diffusion_generate(input_ids,
README.md+4-3