from transformers import AutoModelForCausalLM, AutoTokenizer
from huggingface_hub import login
import torch

login('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')
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-7B")  
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-7B")

prompt = "The capital of France is"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model(**inputs)

logits = outputs.logits
probs = torch.softmax(logits, dim=-1)
print(logits)
print(probs)
# import requests

# API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-v0.1"
# headers = {"Authorization": "Bearer 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"}

# def query(payload):
# 	response = requests.post(API_URL, headers=headers, json=payload)
# 	return response.json()
	
# output = query({
# 	"inputs": "Can you please let us know more details about your ",
# 	"options": {"return_logits": True}
# })

# print(output)