Views
No views yet
1from huggingface_hub import snapshot_download
2
3# Replace with your Hugging Face token (optional but recommended)
4# token = ""
5
6# Replace with the repository ID you want to download
7repo_id = "ICEPVP8977/Uncensored_llama_3.2_3b_safetensors"
8
9try:
10 snapshot_download(repo_id=repo_id,
11 # token=token,
12 local_dir="./model")
13 print(f"Successfully downloaded {repo_id} to ./model")
14except Exception as e:
15 print(f"Error downloading repository: {e}")1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4
5
6model = AutoModelForCausalLM.from_pretrained("./model", torch_dtype=torch.float16, device_map="auto")
7tokenizer = AutoTokenizer.from_pretrained("./model")1prompt = "Your_question_here"
2inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
3max_new_tokens = 2000 # Set the maximum number of tokens in the response
4outputs = model.generate(**inputs, max_new_tokens=max_new_tokens)
5response = tokenizer.decode(outputs[0], skip_special_tokens=True)
6print(response)