import subprocess
import os
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer


result = subprocess.run('bash -c "source /etc/network_turbo && env | grep proxy"', shell=True, capture_output=True, text=True)
output = result.stdout
for line in output.splitlines():
    if '=' in line:
        var, value = line.split('=', 1)
        os.environ[var] = value
        #    'meta-llama/Meta-Llama-3.1-8B-Instruct'
model_id = 'meta-llama/Llama-3.1-8B-Instruct'
tokenizer = AutoTokenizer.from_pretrained(model_id,   token = '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')

model = AutoModelForCausalLM.from_pretrained(model_id, 
                                            # attn_implementation=attn_implementation, 
                                            torch_dtype=torch.bfloat16, 
                                            # device_map=device_map
                                            token = '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'
                                            ).eval() 
