Edit model card

Model Card for Model ID

This modelcard aims to be a base template for new models. It has been generated using this raw template.

Model Details

Model Description

  • Developed by: [More Information Needed]
  • Funded by [optional]: [More Information Needed]
  • Shared by [optional]: [More Information Needed]
  • Model type: [More Information Needed]
  • Language(s) (NLP): [More Information Needed]
  • License: [More Information Needed]
  • Finetuned from model [optional]: [More Information Needed]

Model Sources [optional]

  • Repository: [More Information Needed]
  • Paper [optional]: [More Information Needed]
  • Demo [optional]: [More Information Needed]

Uses

Direct Use

IMPORTS

pip install trl peft torch datasets transformers jupyterlab accelerate tiktoken matplotlib bitsandbytes evaluate scikit-learn
from huggingface_hub import login
login(token="secret-token")

from transformers import AutoModelForCausalLM,AutoTokenizer
from transformers import BitsAndBytesConfig
import torch


GPU_use = 1
st = "cuda:"+str(GPU_use)
torch.cuda.set_device(GPU_use)
import datasets
ds = datasets.load_dataset('marcomaccarini/ds_robot_33_large')

trn = ds['train']


import torch
from peft import PeftModel
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig, AutoModel, TFBertForQuestionAnswering,TFAutoModelWithLMHead

from peft import PeftModel
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig

base_model = 'meta-llama/Meta-Llama-3-8B'
tokr = AutoTokenizer.from_pretrained(base_model)

model = AutoModelForCausalLM.from_pretrained("marcomaccarini/sinthLA", torch_dtype=torch.bfloat16, device_map=GPU_use,token=access_token)


fmt = """
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
USER: {}
===
{}
ASSISTANT:"""

def sql_prompt(d): return fmt.format(d["context"], d["question"])
def question(table, quest):
tst = dict(**trn[8])
tst['context'] = table
tst['question'] = quest
return sql_prompt(tst)


t = 'table([ eof x: 421 y: -115 z: 125, gripper: open , black-cup x: 321 y: 217 z: 80, green-cube x: 425 y: -120 z: 80 or: 14 ])'
q = 'pick green-cube and place to black-cup'
#print(question(t,q))
test = question(t,q)
toks = tokr(test, return_tensors="pt")
res = model.generate(**toks.to(st), max_new_tokens=100, top_p = 0).to('cpu')


print(tokr.batch_decode(res)[0].replace("*","\n"))
Downloads last month
0
Safetensors
Model size
8.03B params
Tensor type
BF16
·
Inference API
Unable to determine this model’s pipeline type. Check the docs .

Model tree for marcomaccarini/SynthLA

Adapter
this model

Dataset used to train marcomaccarini/SynthLA