Quantifying the Carbon Emissions of Machine Learning
Paper • 1910.09700 • Published • 41
Use the code below to get started with the model.
pip install requests
import requests
HF_READ_TOKEN = "hf_token" # Use yor read-token, it is free
API_URL = "https://api-inference.huggingface.co/models/sofanorai/sofanor-7b"
headers = {"Authorization": f"Bearer {HF_READ_TOKEN}"}
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 ",
})
python your_file.py
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).