CoolFace
Modelpublic

peshkatari/test-data

sourceHugging Faceotherupdated 3y agoView on Hugging Face
0likes13downloads
README.md40 linesDownload Raw Back to root
1---2tags:3- autotrain4- text-generation5widget:6- text: "I love AutoTrain because "7license: other8---9 10# Model Trained Using AutoTrain11 12This model was trained using AutoTrain. For more information, please visit [AutoTrain](https://hf.co/docs/autotrain).13 14# Usage15 16```python17 18from transformers import AutoModelForCausalLM, AutoTokenizer19 20model_path = "PATH_TO_THIS_REPO"21 22tokenizer = AutoTokenizer.from_pretrained(model_path)23model = AutoModelForCausalLM.from_pretrained(24    model_path,25    device_map="auto",26    torch_dtype='auto'27).eval()28 29# Prompt content: "hi"30messages = [31    {"role": "user", "content": "hi"}32]33 34input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, add_generation_prompt=True, return_tensors='pt')35output_ids = model.generate(input_ids.to('cuda'))36response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)37 38# Model response: "Hello! How can I assist you today?"39print(response)40```