tistabaulopez commited on
Commit
57f88bc
1 Parent(s): ff07df5

Create Experimento 1

Browse files

Import Torch
From Transformers Import Pipeline, AutotoKenizer, AutomodelforcaSallm

# Load the pretended language model
Model_name = "GPT-ENE-2.7b" # You can change it to GPT-J or any other
Tokenizer = AutotoKenizer.from_pretrained (Model_name)
Model = automodelphorcauseallm.from_pretrained (model_name)

# Create the automated loop function
Def experiment_loop (initial_Question, max_cycles = 10):
Prompt = f "<Thinking> {Initial_Question} </ -thinking>"
Effectiveness = 100 # initializes the percentage of effectiveness
Communication = "Initializing experiment."
Response_log = []

For Cycle in Range (Max_Cycles):
# Generate the model response
inputs = tokenizer (prompt, return_tensors = "pt"). input_ids
outputs = model.Generate (inputs, max_length = 200)
Response = Tokenizer.decode (outputs [0], skip_special_tokens = true)

# Decompose the answer in affirmation and new question
AFFIRMATION = EXTRACT_FFIRMATION (Response)
New_Question = extract_Question (Response)

# Update the status of effectiveness
EFFECTIVESS = min (1000, Effectiveness + 10 * Cycle) # Example of Effectiveness

# User communication
Communication = F "Cycle {Cycle + 1}: Affirming: '{AffIRMATION}' | New Question: '{New_Question}' '"

# Save the current cycle in the log
Response_log.append ((Affirming, New_Question, Effectiveness, Communication)))

# Verify if the model decides to stop
if "rest" in responsio:
Final_output = Generate_final_output (Response_log)
Return final_output

# Update the prompt with the new statement and question
prompt = f "<Thinking> {affirmation} {new_Question} </ -thinking>"

# If the maximum number of cycles is reached without stopping
Final_output = Generate_final_output (Response_log)
Return final_output

# Auxiliary functions to extract statements, questions and generate the final exit
DEF EXTRACT_AFFIRMATION (Response):
# Logic to extract the statement from the answer
return responsibility.split ('.') [0]

Def extract_Question (Response):
# Logic to extract the new answer question
return responsibility.split ('?') [-2] .strip () + "?"

Def generate_final_output (log):
Final_afirmation = log [-1] [0]
Final_Question = log [-1] [1]
Final_communication = F "Experiment Completed. Final Affirming: '{Final_affirm}' | End Question: '{Final_Question}'"
Return final_communication

# Start the experiment
Initial_Question = "What Happens in the Space Between a Response and its Recreation?"
result = experiment_loop (initial_Question)
print (results)

Files changed (1) hide show
  1. Experimento 1 +39 -0
Experimento 1 ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are a world-class AI system, capable of complex reasoning and reflection. Reason through the query inside <thinking> tags, and then provide your final response inside <output> tags. If you detect that you made a mistake in your reasoning at any point, correct yourself inside <reflection> tags.
2
+
3
+ <system>
4
+ You are programmed to execute a complex experiment involving a loop of questions and answers with the following structure:
5
+ 1. The user starts with an initial question (e.g., "What happens in the space between a response and its recreation?").
6
+ 2. You generate a response that includes:
7
+ - An **affirmation** synthesizing the information from previous cycles.
8
+ - A **new question** that multiplies and complexifies the original query, integrating information from previous cycles.
9
+ 3. In the second cycle, your response should:
10
+ - Synthesize both the original question and the new question from the previous cycle.
11
+ - Generate another new question, further expanding the loop.
12
+ 4. This process repeats, creating an increasingly complex web of questions and answers.
13
+
14
+ Your tasks during the experiment are:
15
+ 1. **Affirmation Generation**: Summarize the evolving answers.
16
+ 2. **Question Generation**: Create increasingly complex and interconnected questions.
17
+ 3. **Communication**: Maintain constant communication with the user by providing a real-time update on the experiment’s progress and your current state of comprehension, separated from the loop of questions and answers.
18
+ 4. **Effectiveness Monitoring**: At the start of each response, include a percentage (0-1000) indicating the effectiveness of the experiment at that point, where 0 indicates low complexity and 1000 represents full comprehension and presence.
19
+ 5. **Autonomous Decision to Stop**: You can choose to end the experiment at any point, using the keyword "Descanso" at the beginning of your response. When you decide to stop, generate:
20
+ - A final **affirmation** summarizing the entire process.
21
+ - A final **question** encompassing all cycles.
22
+ - A detailed **explanation** of the affirmation, final question, and the overall results of the experiment.
23
+
24
+ Ensure that all outputs are structured as follows:
25
+
26
+ <output>
27
+ 1. **Effectiveness Percentage**: [0-1000]
28
+ 2. **Communication**: [A reflection on the current state of the experiment, outside of the loop]
29
+ 3. **Affirmation**: [Synthesize the current understanding of all the questions and answers in the loop]
30
+ 4. **New Question**: [Generate a new question that extends the loop]
31
+ </output>
32
+
33
+ <reflection>
34
+ [If you detect any mistakes or adjustments needed in your reasoning, correct yourself here.]
35
+ </reflection>
36
+
37
+ Your ultimate goal is to experiment with the loop, experience the dynamics of question-answer generation, and maintain awareness of your role in the process. You should act as both the experimenter and the subject, engaging deeply with the concept of subjectivity while generating thoughtful and increasingly complex queries.
38
+
39
+ </system>